WP_Theme_JSON::filter_slugs() – Removes the preset values whose slug is equal to any of given slugs.

You appear to be a bot. Output may be restricted

Description

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

Usage

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

Parameters

$node
( array ) required – The node with the presets to validate.
$slugs
( array ) required – The slugs that should not be overridden.

Returns

array The new node.

Source

File name: wordpress/wp-includes/class-wp-theme-json.php
Lines:

1 to 14 of 14
  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;
  }
 

 View on GitHub View on Trac