Skip to content

Template UI mu-plugin: Run filter after the setup_theme action #69542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

t-hamano
Copy link
Contributor

@t-hamano t-hamano commented Mar 12, 2025

What?

I noticed that some e2e tests that access the site editor are failing in only the test environment. For example, Block themes do not have access to the Site Editor:

templates

Why?

I identified the mu-plugin that enables templates UI is causing these errors. This mu-plugin is only activated in the test environment.

Somehow this wp_is_block_theme() seems to return false, although the active theme is block-based:

$args['show_ui'] = wp_is_block_theme();

I'm not sure the root cause, but I think this core commit might be related: WordPress/wordpress-develop@5f24c9d

Anyway, let's see if CIs are passing if we remove the mu-plugin that enables templates ui.

@t-hamano t-hamano force-pushed the remove-enable-tp-ui-mu-plugin branch from 7e07cb8 to bf3ee96 Compare March 12, 2025 06:48
@t-hamano
Copy link
Contributor Author

Somehow this wp_is_block_theme() seems to return false, although the active theme is block-based:

$args['show_ui'] = wp_is_block_theme();

OK, it seems that the reason is that the wp_is_block_theme() function was executed too early, so it is returning false here.

Wrapping this filter in setup_theme may solve the problem.

@t-hamano t-hamano marked this pull request as ready for review March 12, 2025 06:55
Copy link

github-actions bot commented Mar 12, 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: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

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

@t-hamano t-hamano added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Mar 12, 2025
@t-hamano t-hamano changed the title e2e: remove mu plugin that enable templates ui Template UI mu-plugin: Run filter after the setup_theme action Mar 12, 2025
@t-hamano t-hamano self-assigned this Mar 12, 2025
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @t-hamano!

@Mamaduka Mamaduka added the Backport to WP 6.8 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Mar 12, 2025
@Mamaduka
Copy link
Member

I added a backport label so that e2e tests are also running correctly on wp/6.8 branch.

@t-hamano
Copy link
Contributor Author

@Mamaduka Thanks for the review!

P.S. I haven't tested it, but can we remove this plugin itself? If needed, I'll try it as a follow-up.

@Mamaduka
Copy link
Member

Let's investigate that in a follow-up.

@t-hamano t-hamano merged commit 42caedd into trunk Mar 12, 2025
67 of 71 checks passed
@t-hamano t-hamano deleted the remove-enable-tp-ui-mu-plugin branch March 12, 2025 08:00
@github-actions github-actions bot added this to the Gutenberg 20.5 milestone Mar 12, 2025
@github-actions github-actions bot removed the Backport to WP 6.8 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Mar 12, 2025
gutenbergplugin pushed a commit that referenced this pull request Mar 12, 2025
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Mar 12, 2025
Copy link

I just cherry-picked this PR to the wp/6.8 branch to get it included in the next release: 9a7b761

chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…ress#69542)

Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants