diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index f6ba9f5d09de6..8603a4cbbd169 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -2714,9 +2714,10 @@ private static function get_block_nodes( $theme_json, $selectors = array(), $opt return $nodes; } - foreach ( $theme_json['styles']['blocks'] as $name => $node ) { + $include_variations = $options['include_block_style_variations'] ?? false; + $include_node_paths_only = $options['include_node_paths_only'] ?? false; - $include_node_paths_only = $options['include_node_paths_only'] ?? false; + foreach ( $theme_json['styles']['blocks'] as $name => $node ) { $node_path = array( 'styles', 'blocks', $name ); if ( $include_node_paths_only ) { $nodes[] = array( @@ -2739,7 +2740,6 @@ private static function get_block_nodes( $theme_json, $selectors = array(), $opt } $variation_selectors = array(); - $include_variations = $options['include_block_style_variations'] ?? false; if ( $include_variations && isset( $node['variations'] ) ) { foreach ( $node['variations'] as $variation => $node ) { $variation_selectors[] = array(