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 in other core functions. 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

	$p->skip_to_tag_closer();
	continue;
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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