Make WordPress Core


Ignore:
Timestamp:
07/29/2022 08:29:13 AM (2 years ago)
Author:
audrasjb
Message:

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.

This changeset 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 the theme author's perspective.

Props ndiego, ryelle.
Fixes #56112.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-patterns.php

    r53312 r53793  
    134134 */
    135135function _register_remote_theme_patterns() {
    136     if ( ! get_theme_support( 'core-block-patterns' ) ) {
    137         return;
    138     }
    139 
    140136    /** This filter is documented in wp-includes/block-patterns.php */
    141137    if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) {
Note: See TracChangeset for help on using the changeset viewer.