Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unregister_block_pattern notices #32025

Merged
merged 1 commit into from
May 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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