Make WordPress Core

Opened 23 months ago

Closed 21 months ago

Last modified 21 months ago

#56112 closed enhancement (fixed)

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

Reported by: ndiego's profile ndiego Owned by: audrasjb's profile audrasjb
Milestone: 6.0.2 Priority: normal
Severity: normal Version: 6.0
Component: Editor Keywords: has-patch fixed-major
Focuses: Cc:

Description

Fixes: https://github.com/WordPress/gutenberg/issues/41282

In 6.0 we now have functionality that allows you to register selected remote patterns (from the Pattern Directory) via theme.json. While this is great, it requires you to fully enable all core and remote patterns. This can be a blocker to adoption.

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

This PR/Trac ticket removes the theme support and remote filter checks 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. We assume that if a theme author intentionally specifies patterns in theme.json, they intend for them to be present in the pattern inserter and the checks are not required.

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

Note, that while this issue is technically not a "bug", it is a pretty large blocker for Pattern Directory adoption and I feel should be considered for 6.0.1.

Change History (12)

This ticket was mentioned in PR #2925 on WordPress/wordpress-develop by ndiego.


23 months ago
#1

  • Keywords has-patch added

Fixes: https://github.com/WordPress/gutenberg/issues/41282

In 6.0 we now have functionality that allows you to register selected remote patterns (from the Pattern Directory) via theme.json. While this is great, it requires you to fully enable all core and remote patterns. This can be a blocker to adoption.

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

This PR/Trac ticket removes the theme support and remote filter checks 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. We assume that if a theme author intentionally specifies patterns in theme.json, they intend for them to be present in the pattern inserter and the checks are not required.

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

Note, that while this issue is technically not a "bug", it is a pretty large blocker for Pattern Directory adoption and I feel should be considered for 6.0.1.

Trac ticket: https://core.trac.wordpress.org/ticket/56112

ryelle commented on PR #2925:


23 months ago
#2

I think removing the get_theme_support( 'core-block-patterns' ) check makes sense here — these aren't core patterns. But the should_load_remote_block_patterns check should stay, in case someone wants to explicitly disable external API requests.

For reference, there's only 1 theme in the wp.org directory that disables the remote loading, but it loads its patterns locally.

ndiego commented on PR #2925:


23 months ago
#3

Thanks for the feedback @ryelle! That makes good sense. I have updated the PR and added back the should_load_remote_block_patterns.

This ticket was mentioned in Slack in #core by ndiego. View the logs.


23 months ago

#5 @SergeyBiryukov
23 months ago

  • Milestone changed from Awaiting Review to 6.0.2

ndiego commented on PR #2925:


22 months ago
#6

Thanks @ryelle, are you able to merge? I don't have permission on this repo. In the meantime, I will put together the corresponding PR needed on the Gutenberg side.

#7 @audrasjb
22 months ago

  • Owner set to audrasjb
  • Status changed from new to accepted

Self assigning for commit as asked by Nick in this thread.

Last edited 22 months ago by audrasjb (previous) (diff)

#8 @audrasjb
22 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 53793:

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.

#9 @audrasjb
22 months ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 6.0.2 backport consideration.

#11 @audrasjb
21 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 53903:

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.

This ticket was mentioned in Slack in #core by costdev. View the logs.


21 months ago

Note: See TracTickets for help on using tickets.