Skip to content

Conversation

@ellatrix
Copy link
Member

@ellatrix ellatrix commented Oct 8, 2025

What?

Adds meta to any templates created from this point forward, so we can easily distinguish between templates created the old way and new way.

Why?

  1. This makes the migrate function more stable: if the active_templates option is ever removed, any new templates created will not suddenly become activated due to this migration, only the old templates will.
  2. It gives us a bit more room to fix migrations in case of a revert of the whole feature.

How?

Adds the meta any time a template is created from now on. In the migration function, check that the templates do not have this meta.

To do: when you de-activate one of the old templates, ideally we should add the meta to them.

Idea: perhaps there is a way we can avoid the migration entirely: if a template doesn't have the inactive_by_default meta, then it should just be considered active regardless of the option. It makes the checks for activation a bit more complex though.

Testing Instructions

Create a new template. Delete the active_templates option. This new templates should not be activated due to the migration function.

Testing Instructions for Keyboard

Screenshots or screencast

Before After

@ellatrix ellatrix requested a review from spacedmonkey as a code owner October 8, 2025 07:56
@ellatrix ellatrix added [Type] Bug An existing feature does not function as intended Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) labels Oct 8, 2025
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ellatrix <ellatrix@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Flaky tests detected in a24a6bf.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18337991305
📝 Reported issues:

@ellatrix ellatrix force-pushed the add/template-activation-meta branch from a24a6bf to 83cee2f Compare October 8, 2025 11:13
@ellatrix
Copy link
Member Author

ellatrix commented Oct 8, 2025

Merging because this is blocking GB stable. Let me know if there's concerns and I'll follow up.

@ellatrix ellatrix enabled auto-merge (squash) October 8, 2025 14:57
@ellatrix ellatrix disabled auto-merge October 8, 2025 14:57
@ellatrix ellatrix merged commit ef12fda into trunk Oct 8, 2025
68 checks passed
@ellatrix ellatrix deleted the add/template-activation-meta branch October 8, 2025 14:58
@github-actions github-actions bot added this to the Gutenberg 21.9 milestone Oct 8, 2025
@cbravobernal
Copy link
Contributor

I just cherry-picked this PR to the release/21.8 branch to get it included in the next release: e051b13

@cbravobernal cbravobernal removed the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Oct 8, 2025
sidharthpandita1 pushed a commit to sidharthpandita1/gutenberg that referenced this pull request Oct 10, 2025
@ellatrix ellatrix mentioned this pull request Oct 16, 2025
8 tasks
ellatrix added a commit that referenced this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants