WP_Interactivity_API::process_directives()publicWP 6.5.0

Processes the interactivity directives contained within the HTML content and updates the markup accordingly.

Метод класса: WP_Interactivity_API{}

Хуков нет.

Возвращает

Строку. The processed HTML content. It returns the original content when the HTML contains unbalanced tags.

Использование

$WP_Interactivity_API = new WP_Interactivity_API();
$WP_Interactivity_API->process_directives( $html ): string;
$html(строка) (обязательный)
The HTML content to process.

Список изменений

С версии 6.5.0 Введена.

Код WP_Interactivity_API::process_directives() WP 6.7.1

public function process_directives( string $html ): string {
	if ( ! str_contains( $html, 'data-wp-' ) ) {
		return $html;
	}

	$this->namespace_stack = array();
	$this->context_stack   = array();

	$result = $this->_process_directives( $html );

	$this->namespace_stack = null;
	$this->context_stack   = null;

	return null === $result ? $html : $result;
}