WP_Theme_JSON::filter_slugs
Removes the preset values whose slug is equal to any of given slugs.
Method of the class: WP_Theme_JSON{}
No Hooks.
Returns
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. |
WP_Theme_JSON::filter_slugs() WP Theme JSON::filter slugs code WP 6.8.3
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;
}