Skip to content

Commit

Permalink
Fix the actual bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Mar 6, 2023
1 parent 308066b commit d1dcd9d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/wp-includes/global-styles-and-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,18 @@ function wp_add_global_styles_for_blocks() {
* @return string Identified block name, or empty string if none found.
*/
function wp_get_block_name_from_theme_json_path( $path ) {
// Block name is expected to be the third item after 'styles' and 'blocks'.
if (
count( $path ) >= 3
&& 'styles' === $path[0]
&& 'blocks' === $path[1]
&& str_contains( $path[2], '/' )
) {
return $path[2];
}

// As fallback and for backward compatibility, allow any core block to be
// at any position.
$result = array_values(
array_filter(
$path,
Expand Down

0 comments on commit d1dcd9d

Please sign in to comment.