Make WordPress Core

Opened 16 months ago

Last modified 12 months ago

#57129 new defect (bug)

Wrong Page Template Displayed in 6.1.x

Reported by: taupecat's profile taupecat Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 6.1.1
Component: Administration Keywords: needs-patch
Focuses: ui Cc:

Description

Starting with 6.1, the wrong (newly revamped?) page template display in the page editing screen shows the wrong template.

In the attached screen shots, the page in question is using a template called "Blog Landing Page", but the display says "Default template". When you click "Default template", it brings up the selector box which shows that it is indeed the Blog Landing Page template, but even when the selection is made again and the "Update" button is clicked, the wrong template name is displayed.

I first noticed this error with WordPress 6.1, and it is still there in 6.1.1.

Attachments (2)

Screenshot 2022-11-16 at 8.08.45 AM.png (20.0 KB) - added by taupecat 16 months ago.
Screenshot of the wrong template name being displayed.
Screenshot 2022-11-16 at 8.08.57 AM.png (39.3 KB) - added by taupecat 16 months ago.
Screenshot of the page template selection field, displaying that the correct page template is chosen.

Download all attachments as: .zip

Change History (16)

@taupecat
16 months ago

Screenshot of the wrong template name being displayed.

@taupecat
16 months ago

Screenshot of the page template selection field, displaying that the correct page template is chosen.

#1 @petitphp
16 months ago

  • Keywords reporter-feedback added

Hi @taupecat, thanks for the ticket.

I couldn't replicate the bug on my side.

The steps used to test the issue according to the description :

  1. create a WordPress instance in 5.9 or 6.0
  2. declare a custom page template
  3. create a page and assign the custom page template
  4. publish the page
  5. update WordPress to 6.1
  6. edit the page created in step 3

Expected result (bug in description) :

  • the template shown in the sidebar is "Default Template"
  • opening the template selector control show the correct template

Current result :

  • the correct template is show in the sidebar
  • opening the template selector control show the correct template

Do you have additional information on how to reproduce the bug ?
Did you saw JavaScript error in your browser console ?
Do you have the Gutenberg plugin active on your site ?
Does the issue happen with new pages ?

#2 @smerriman
16 months ago

Exactly the same problem here. It started with 6.1, and occurs not just for existing pages, but any newly created pages.

Note that this is for a theme which does *not* use Full Site Editing. A custom page template was declared in the theme via the usual comment at the top:

<?php
/*
Template Name: xxx
*/
?>

'Default template' always shows, no matter which template is selected. If you click on 'Default template', the dropdown that pops up has the right one selected.

On top of this, I also see a button after clicking 'Default template' that allows me to create a new template with the template editor. This should not exist, since I haven't opted into full site editing, and thus don't want users to see a template editor. I suspect this is related to the bug; the new template selector is probably only supporting full site editing themes.

#3 @petitphp
16 months ago

Thanks for the additional input @smerriman

I did manage to reproduce the issue by creating either a theme.json or a folder /templates/index.html or a folder block-templates/index.html in a classic theme (twentytwenty). This will trick WordPress into believing the theme is block based.

A quick workaround would be to remove the index.html file in the folders mentioned above (templates or blocks-templates).

#4 @taupecat
16 months ago

In my case, the theme is a custom developed block-based theme, but not FSE theme, that I wrote for the client (the site launched about a year ago, and was recently updated, but not to an FSE theme). It has a both a theme.json and block.json files, which are being used. There is no index.html file anywhere in the entire theme.

So this appears that it's still a bug that needs addressing for that scenario.

And agreed with @smerriman, we need to be able to turn off the indication to create a new template when it's not an option for the theme and something the client shouldn't be seeing.

Thanks.

This ticket was mentioned in Slack in #core-editor by petitphp. View the logs.


16 months ago

#6 @petitphp
16 months ago

@taupecat After checking with someone in the editor team, there is already an existing issue in the Gutenberg repository for the bug you described : https://github.com/WordPress/gutenberg/issues/45216.

@smerriman I saw you already open an issue in the GitHub repository. Can you confirm you are using a classic theme without any blocks ?

#7 @taupecat
16 months ago

Ok, good to know that this is a known issue and that it is being addressed.

Thanks much.

#8 @lancehillier
16 months ago

#57181 was marked as a duplicate.

#9 @smerriman
15 months ago

It appears that Gutenberg developers have decided that any theme with a theme.json should have block templates automatically enabled.

Adding remove_theme_support( 'block-templates' ); resolves this. Very frustrating that this would need to be added to old themes to prevent unwanted features showing up, but that seems to be a common problem these days.

#10 @taupecat
15 months ago

@smerriman That would be extremely disappointing. It's not always possible to backfill older custom projects that have been handed off to clients.

I suppose one could write a plugin, but again, site owners would have to know what the problem even is in order to know to install a plugin to fix it.

It doesn't make much sense to me that even though numerous people have been identifying this as a problem, yet the consensus among WP and Gutenberg's core developers is to ¯\_(ツ)_/¯.

#11 @taupecat
15 months ago

  • Keywords reporter-feedback removed

#12 @poena
15 months ago

Yes adding a theme.json enables template editing, it is a documented feature with theme.json and not a bug.

This ticket was mentioned in Slack in #core-editor by petitphp. View the logs.


15 months ago

#14 @SergeyBiryukov
12 months ago

#57798 was marked as a duplicate.

Note: See TracTickets for help on using tickets.