Skip to content

Commit

Permalink
Editor: Fix core 'Featured' pattern category registration
Browse files Browse the repository at this point in the history
Backports changes from WordPress/gutenberg#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.


Built from https://develop.svn.wordpress.org/trunk@53312


git-svn-id: http://core.svn.wordpress.org/trunk@52901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
gziolo committed Apr 29, 2022
1 parent 6333a1d commit a972e81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions wp-includes/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) ) );
Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-beta3-53311';
$wp_version = '6.0-beta3-53312';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit a972e81

Please sign in to comment.