WP_Interactivity_API::process_directives
Processes the interactivity directives contained within the HTML content and updates the markup accordingly.
Method of the class: WP_Interactivity_API{}
No Hooks.
Returns
String. The processed HTML content. It returns the original content when the HTML contains unbalanced tags.
Usage
$WP_Interactivity_API = new WP_Interactivity_API(); $WP_Interactivity_API->process_directives( $html ): string;
- $html(string) (required)
- The HTML content to process.
Changelog
| Since 6.5.0 | Introduced. |
WP_Interactivity_API::process_directives() WP Interactivity API::process directives code WP 7.0
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 $result ?? $html;
}