Patterns: Fix core 'Featured' pattern category registration#40650
Conversation
|
I am having trouble getting this to work for me. The trick is that Twenty Twenty-Two registered the "Featured" category itself, even though it didn't have to. You need to comment out line 17 of |
|
@ndiego, That's how I was testing this fix. I forgot to mention it in the description. You can test this with the 2016 theme. It doesn't register the featured category. |
ndiego
left a comment
There was a problem hiding this comment.
Ugh, my bad. I was on your branch to start testing, then got distracted with another branch. I then ended up testing on the wrong branch. 🤦♂️
Just tested using Twenty Sixteen and Frost. Frost uses the new method of registering patterns in the /patterns folder. Both work as advertised. 🙌
I will note that this does not work if the theme has remove_theme_support( 'core-block-patterns' ); set. I think that is ok. If they are disabling all the core patterns, then they want a custom experience and should likely register the "Featured" category themselves if they want it.
Happens to me all the time 😅
I think this should be expected behavior. Thanks for testing, @ndiego. |
|
Should we add the |
|
@priethor, this requires separate Core patch, and I will create it tomorrow. |
|
Core patch is ready - WordPress/wordpress-develop#2640. |
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53312 602fd350-edb4-49c9-b593-d223f7449a82
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
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: https://core.svn.wordpress.org/trunk@52901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
Resolves #40443.
PR fixes issue with missing core "Featured" patterns category.
Why?
Regression after Gutenberg started loading patterns via REST API (#39185), the
_load_remote_featured_patternsmethod isn't called during WP initialization.How?
Updates method that registered the category.
P.S. This will be handled via
_register_core_block_patterns_and_categorieswhen backported into WP Core.Testing Instructions
Screenshots or screencast