Skip to content

Site Editor: templates do not save if already edited in another theme #28951

@Sandstromer

Description

@Sandstromer

Description

In the Site Editor, when editing a template or a template part, unable to save if template or template part already exists as a previously edited template from another theme.

Step-by-step reproduction instructions

Install more than one FSE enabled theme e.g. TT1 Blocks and Q
Activate either theme.
Go to Site Editor and make changes to a template part (e.g. header) or a template (e.g. index), save changes by clicking Update Design.
Exit the Site Editor, go to Appearance > Themes and switch themes to the other FSE theme.
Go back into Site Editor and make changes to a template e.g. if you previously edited header in TT1 Blocks theme, then edit the header in Q theme.
Click Update Design to save and the button should change state to disabled to signify that the changes have been saved.
Notice the button stays active.
Exit the Site Editor and notice the 'This page is asking you to confirm that you want to leave - data you have entered may not be saved.' message. Click 'Leave Page' to exit the Site Editor.
View the live site and notice how the edited template has not changed.
Go to Appearance > Themes and switch back to TT1 Blocks theme, view the live site and notice how the template has now changed to the template that we were trying to edit when the Q theme was active.

Expected behaviour

The template or template part should only save for the active theme, not another theme with the same previously edited template name.

Actual behaviour

The template or template part is saved for the wrong theme.

Screenshots or screen recording (optional)

Code snippet (optional)

WordPress information

  • WordPress version: 5.6.1
  • Gutenberg version: 9.9.2
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes and No. TT1 Blocks and Q

Device information

  • Device: Desktop
  • Operating system: Win 10
  • Browser: Firefox

Metadata

Metadata

Labels

[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions