WP_Interactivity_API::extract_prefix_and_suffix( string $directive_name ): array

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Extracts the directive attribute name to separate and return the directive prefix and an optional suffix.

Description

The suffix is the string after the first double hyphen and the prefix is everything that comes before the suffix.

Example:

extract_prefix_and_suffix( 'data-wp-interactive' )   => array( 'data-wp-interactive', null )
extract_prefix_and_suffix( 'data-wp-bind--src' )     => array( 'data-wp-bind', 'src' )
extract_prefix_and_suffix( 'data-wp-foo--and--bar' ) => array( 'data-wp-foo', 'and--bar' )

Parameters

$directive_namestringrequired
The directive attribute name.

Return

array An array containing the directive prefix and optional suffix.

Source

* This method registers a script module to be loaded during client-side
* navigation in the Interactivity API router. Script modules marked with
* this method will have the `loadOnClientNavigation` option enabled in the

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.