Skip to content

Commit

Permalink
Fix unregister_block_pattern notices (#32025)
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks authored May 20, 2021
1 parent 770b1a3 commit 635ffee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ function remove_core_patterns() {
);

foreach ( $core_block_patterns as $core_block_pattern ) {
unregister_block_pattern( 'core/' . $core_block_pattern );
$name = 'core/' . $core_block_pattern;
if ( WP_Block_Patterns_Registry::get_instance()->is_registered( $name ) ) {
unregister_block_pattern( $name );
}
}
}

Expand All @@ -212,7 +215,7 @@ function remove_core_patterns() {
function load_remote_patterns() {
$patterns = get_transient( 'gutenberg_remote_block_patterns' );
if ( ! $patterns ) {
$request = new WP_REST_Request( 'GET', '/__experimental/pattern-directory/patterns' );
$request = new WP_REST_Request( 'GET', '/__experimental/pattern-directory/patterns' );
$core_keyword_id = 11; // 11 is the ID for "core".
$request->set_param( 'keyword', $core_keyword_id );
$response = rest_do_request( $request );
Expand Down

0 comments on commit 635ffee

Please sign in to comment.