From 2b0a9842273170944be6d60843b8341722e82b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=83=C2=B3=C3=85=E2=80=9Akowski?= Date: Fri, 29 Apr 2022 14:08:44 +0000 Subject: [PATCH] Editor: Fix core 'Featured' pattern category registration Backports changes from https://github.com/WordPress/gutenberg/pull/40650. Patch fixes regression, and moves core "Featured" pattern category registration from `_load_remote_featured_patterns` into `_register_core_block_patterns_and_categories`. Follow-up [53152]. Props mamaduka, ntsekouras. See #55567. git-svn-id: https://develop.svn.wordpress.org/trunk@53312 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/block-patterns.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/wp-includes/block-patterns.php b/src/wp-includes/block-patterns.php index 8b922e7dd1..58ec8443b1 100644 --- a/src/wp-includes/block-patterns.php +++ b/src/wp-includes/block-patterns.php @@ -38,6 +38,7 @@ function _register_core_block_patterns_and_categories() { register_block_pattern_category( 'buttons', array( 'label' => _x( 'Buttons', 'Block pattern category' ) ) ); register_block_pattern_category( 'columns', array( 'label' => _x( 'Columns', 'Block pattern category' ) ) ); + register_block_pattern_category( 'featured', array( 'label' => _x( 'Featured', 'Block pattern category' ) ) ); register_block_pattern_category( 'gallery', array( 'label' => _x( 'Gallery', 'Block pattern category' ) ) ); register_block_pattern_category( 'header', array( 'label' => _x( 'Headers', 'Block pattern category' ) ) ); register_block_pattern_category( 'text', array( 'label' => _x( 'Text', 'Block pattern category' ) ) ); @@ -104,10 +105,6 @@ function _load_remote_featured_patterns() { return; } - if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( 'featured' ) ) { - register_block_pattern_category( 'featured', array( 'label' => __( 'Featured' ) ) ); - } - $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); $featured_cat_id = 26; // This is the `Featured` category id from pattern directory. $request->set_param( 'category', $featured_cat_id );