From cc594f10c5ead8fdf59143af06d412cc74860697 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Fri, 18 Oct 2024 11:09:53 +0530 Subject: [PATCH] Update class-wp-theme-json.php --- src/wp-includes/class-wp-theme-json.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 8603a4cbbd169..5be14283a7d97 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -2703,13 +2703,8 @@ private static function update_separator_declarations( $declarations ) { * @return array The block nodes in theme.json. */ private static function get_block_nodes( $theme_json, $selectors = array(), $options = array() ) { - $selectors = empty( $selectors ) ? static::get_blocks_metadata() : $selectors; - $nodes = array(); - if ( ! isset( $theme_json['styles'] ) ) { - return $nodes; - } + $nodes = array(); - // Blocks. if ( ! isset( $theme_json['styles']['blocks'] ) ) { return $nodes; } @@ -2717,6 +2712,10 @@ private static function get_block_nodes( $theme_json, $selectors = array(), $opt $include_variations = $options['include_block_style_variations'] ?? false; $include_node_paths_only = $options['include_node_paths_only'] ?? false; + if ( ! $include_node_paths_only ) { + $selectors = empty( $selectors ) ? static::get_blocks_metadata() : $selectors; + } + foreach ( $theme_json['styles']['blocks'] as $name => $node ) { $node_path = array( 'styles', 'blocks', $name ); if ( $include_node_paths_only ) {