WP_Interactivity_API::get_element()publicWP 6.7.0

Returns an array representation of the current element being processed.

The returned array contains a copy of the element attributes.

Method of the class: WP_Interactivity_API{}

No Hooks.

Returns

Array{attributes:. array<string, string|bool>}|null Current element.

Usage

$WP_Interactivity_API = new WP_Interactivity_API();
$WP_Interactivity_API->get_element(): ?array;

Changelog

Since 6.7.0 Introduced.

WP_Interactivity_API::get_element() code WP 6.8.1

public function get_element(): ?array {
	if ( null === $this->current_element ) {
		_doing_it_wrong(
			__METHOD__,
			__( 'The element can only be read during directive processing.' ),
			'6.7.0'
		);
	}

	return $this->current_element;
}