Skip to content

Commit

Permalink
Patterns: guard for unknown pattern in server-side resolver (WordPres…
Browse files Browse the repository at this point in the history
…s#60464)

Co-authored-by: ellatrix <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
3 people authored and cbravobernal committed Apr 9, 2024
1 parent 6d78358 commit 2200a66
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/compat/wordpress-6.6/resolve-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ function gutenberg_replace_pattern_blocks( $blocks, &$inner_content = null ) {
continue;
}

$registry = WP_Block_Patterns_Registry::get_instance();
$pattern = $registry->get_registered( $slug );
$registry = WP_Block_Patterns_Registry::get_instance();
$pattern = $registry->get_registered( $slug );

// Skip unknown patterns.
if ( ! $pattern ) {
++$i;
continue;
}

$blocks_to_insert = parse_blocks( $pattern['content'] );
$seen_refs[ $slug ] = true;
$blocks_to_insert = gutenberg_replace_pattern_blocks( $blocks_to_insert );
Expand Down

0 comments on commit 2200a66

Please sign in to comment.