Opened 5 months ago
Closed 12 days ago
#62319 closed defect (bug) (fixed)
There is a flash when clicking the template name in the editor if a plugin registered template matches a default WP theme template
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | 6.7 |
Component: | Editor | Keywords: | has-patch commit |
Focuses: | ui, template | Cc: |
Description
Same as this GitHub issue: https://github.com/WordPress/gutenberg/issues/65584
Steps to reproduce:
- Assuming you are using a theme with a
page.html
template (ie: Twenty Twenty Four). - Add this code snippet to your site:
<?php add_action( 'init', function() { register_block_template( 'templates//page', [ 'title' => 'My Single Page', 'description' => 'This is my single page template', 'content' => '<!-- wp:paragraph --><p>This is a plugin-registered template.</p><!-- /wp:paragraph -->', 'post_types' => [ 'page' ], ] ); } );
- Go to the New page screen.
- Click on the Pages button next to the Templates label.
- Notice a flash.
Change History (15)
This ticket was mentioned in PR #7676 on WordPress/wordpress-develop by @aljullu.
5 months ago
#1
- Keywords has-patch added
5 months ago
#2
Thanks for the review, @apermo! Would you mind taking another look? I added a couple of commits that fix some edge cases and add unit tests.
4 months ago
#3
Thanks for the approval, @apermo! I don't have merging rights, is that something you can take care of?
Otherwise, @azaozz, wondering if this is something you can do? Thanks in advance!
4 months ago
#4
Thanks for the approval, @apermo! I don't have merging rights, is that something you can take care of?
I can't merge either, this happens on the subversion by those with commit right(core commiters), I just reviewed.
#5
@
4 months ago
- Keywords needs-testing added
- Milestone changed from Awaiting Review to 6.8
Seems this has been in Gutenberg for a while and needs adding to core.
@ntsekouras commented on PR #7676:
4 months ago
#6
This looks good, but I'd appreciate some more eyes maybe from @anton-vlasenko or @felixarntz ?
3 months ago
#8
@felixarntz I don't have permissions to merge into WordPress, is that something you or somebody else can take care of? :pray:
I see there are a couple of checks failing, but they seem unrelated to this PR.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
13 days ago
@audrasjb commented on PR #7676:
13 days ago
#10
I tested the PR and it seems to fix the issue:
Before:
[Uploading before-applying-the-PR.webm…]()
After:
@audrasjb commented on PR #7676:
13 days ago
#11
Before:
before-applying-the-PR.webm
After:
after-applying-the-PR.webm
@audrasjb commented on PR #7676:
13 days ago
#12
I tested the PR and it seems to fix the issue:
Before:
[Uploading before-applying-the-PR.webm…]()
After:
@flixos90 commented on PR #7676:
12 days ago
#13
@Aljullu I tested the fix too, together with the code snippet you posted on the ticket:
add_action( 'init', function() {
register_block_template(
'templates//page',
[
'title' => 'My Single Page',
'description' => 'This is my single page template',
'content' => '<p>This is a plugin-registered template.</p>',
'post_types' => [ 'page' ],
]
);
} );
The flash is fixed, and also there was actually another problem before where the "Use default template" button would actually not change the template content displayed. So both of these issues are resolved with this PR.
However, I do not see the custom "My Single Page" template listed now at all. Using the Twenty Twenty-Five theme, when I click "Change Template", I only see the built-in "Page No Title" template, but not the custom one from the above snippet. Without this PR applied, that custom template _does_ show up. So it seems while this PR fixes the problem, it introduces another one?
Can you check on your end please?
This PR includes the changes that need to be backported from https://github.com/WordPress/gutenberg/pull/66359 into WC core.
Trac ticket: https://core.trac.wordpress.org/ticket/62319