WP_Theme_JSON::filter_slugs
Removes the preset values whose slug is equal to any of given slugs.
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Массив. The new node.
Использование
$result = WP_Theme_JSON::filter_slugs( $node, $slugs );
- $node(массив) (обязательный)
- The node with the presets to validate.
- $slugs(массив) (обязательный)
- The slugs that should not be overridden.
Список изменений
| С версии 5.9.0 | Введена. |
Код WP_Theme_JSON::filter_slugs() WP Theme JSON::filter slugs WP 7.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;
}