W3cubDocs

/WordPress

WP_Theme_JSON::get_block_selectors( object $block_type, string $root_selector ): array

Returns the selectors metadata for a block.

Parameters

$block_typeobjectrequired
The block type.
$root_selectorstringrequired
The block’s root selector.

Return

array The custom selectors set by the block.

Source


if ( ! empty( $output ) ) {
	_wp_array_set( $sanitized, $metadata['path'], $output );
}

if ( isset( $metadata['variations'] ) ) {
	foreach ( $metadata['variations'] as $variation ) {
		$variation_input = _wp_array_get( $theme_json, $variation['path'], array() );
		if ( empty( $variation_input ) ) {
			continue;
		}

		$variation_output = static::remove_insecure_styles( $variation_input );

		// Process a variation's elements and element pseudo selector styles.

Changelog

Version Description
6.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_selectors