Themes: Allow remote pattern registration in theme.json when core patterns are disabled.

In 6.0 there is now a functionality that allows to register selected remote patterns (from the Pattern Directory) via `theme.json`. However, it requires to fully enable all core and remote patterns. This can be a blocker for user adoption.

Many theme authors want to have all core and remote patterns disabled by default using `remove_theme_support( 'core-block-patterns' )`. This changeset ensures they are serving only patterns relevant to their theme.

It removes theme support check from the function that registers remote patterns specified in `theme.json`. This allows theme authors to disable core patterns but then selectively register the ones they want from the Pattern Directory. If a theme author intentionally specifies patterns in `theme.json`, they probably intend for them to be present in the pattern inserter and the check is not required.

This change will make the Pattern Directory more appealing/usable from a theme author's perspective.

Props ndiego, ryelle, audrasjb.
Merges [53793] to the 6.0 branch.
Fixes #56112.

Built from https://develop.svn.wordpress.org/branches/6.0@53903


git-svn-id: http://core.svn.wordpress.org/branches/6.0@53462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-08-17 21:14:11 +00:00
parent 90e6f5aed5
commit a3dd623395
2 changed files with 1 additions and 5 deletions

View File

@ -133,10 +133,6 @@ function _load_remote_featured_patterns() {
* @access private
*/
function _register_remote_theme_patterns() {
if ( ! get_theme_support( 'core-block-patterns' ) ) {
return;
}
/** This filter is documented in wp-includes/block-patterns.php */
if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) {
return;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0.2-alpha-53738';
$wp_version = '6.0.2-alpha-53903';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.