WP_Theme_JSON::filter_slugs()protected staticWP 5.9.0

Removes the preset values whose slug is equal to any of given slugs.

{} It's a method of the class: WP_Theme_JSON{}

No Hooks.

Return

Array. The new node.

Usage

$result = WP_Theme_JSON::filter_slugs( $node, $slugs );
$node(array) (required)
The node with the presets to validate.
$slugs(array) (required)
The slugs that should not be overridden.

Changelog

Since 5.9.0 Introduced.

Code of WP_Theme_JSON::filter_slugs() WP 6.0

protected static function filter_slugs( $node, $slugs ) {
	if ( empty( $slugs ) ) {
		return $node;
	}

	$new_node = array();
	foreach ( $node as $value ) {
		if ( isset( $value['slug'] ) && ! in_array( $value['slug'], $slugs, true ) ) {
			$new_node[] = $value;
		}
	}

	return $new_node;
}