WP_Theme_JSON::filter_slugs( array $node, array $slugs ): array

In this article

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

Parameters

$nodearrayrequired
The node with the presets to validate.
$slugsarrayrequired
The slugs that should not be overridden.

Return

array The new node.

Source

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;
}

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

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