Skip to content

Site Editor: Allow changing the homepage's template when the theme has no front-page template - #87760

Open
dpmehta wants to merge 2 commits into
WordPress:trunkfrom
dpmehta:fix/site-editor-homepage-template-switching
Open

dpmehta wants to merge 2 commits into
WordPress:trunkfrom
dpmehta:fix/site-editor-homepage-template-switching

Conversation

@dpmehta

@dpmehta dpmehta commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #87762

Enables the Template control for the homepage in the Site Editor when the theme has no front-page template. This covers the page settings sidebar and Quick Edit, in both the site editor and the extensible site editor.

Why?

The Site Editor disables the homepage's Template control in every case. That's only needed when a front-page template exists, because it always takes precedence. Without one, WordPress uses the template assigned to the homepage, as it does for any page. The post editor already follows this rule in useAllowSwitchingTemplates(), and the classic Quick Edit in wp-admin -> Pages allows any template for the homepage, so only the Site Editor blocks it, and users can't, for example, apply "Page No Title" to their homepage from the Site Editor.

How?

The homepage's Template control is now disabled only when a front-page template exists, matching useAllowSwitchingTemplates(). The posts page stays disabled as before.

The change is in isTemplateSwitchable() (packages/core-fields/src/post_type_supports/template/is-template-switchable.ts), added in #87541. It drives both the template control and the field's isDisabled, so the page settings sidebar and Quick Edit in both site editors follow it.

An e2e test in test/e2e/specs/site-editor/pages.spec.js covers the page settings sidebar and Quick Edit, with and without a front-page template.

Testing Instructions

  1. Activate Twenty Twenty-Five/ ipsum and make sure no "Front Page" template exists.
  2. In Settings -> Reading, set a static page as the homepage.
  3. Go to Appearance -> Editor -> Pages and select the homepage. Open the page settings: the Template field is enabled and lists "Page No Title".
  4. Select "Page No Title" and save. The homepage renders without its title on the frontend.
  5. Open Quick Edit for the homepage from the Pages list. The Template field is enabled there too.
  6. Add a "Front Page" template (Appearance ->Editor ->Templates -> Add template -> Front Page). The homepage's Template field is now disabled again.
  7. Set a posts page in Settings -> Reading. Its Template field stays disabled.

Screenshots or screencast

Before After
before-fix.mov
after-fix.mov

Use of AI Tools

Claude Code was used to trace the cause, write the fix and draft this description. I reviewed the changes and tested them manually as described above.

@github-actions github-actions Bot added the [Package] Fields /packages/fields label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

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: dpmehta <mehtadev@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

@dpmehta dpmehta changed the title Fix/site editor homepage template switching Site Editor: Allow changing the homepage's template when the theme has no front-page template Dec 1, 2026
@dpmehta
dpmehta marked this pull request as ready for review December 1, 2026 14:11
@dpmehta
dpmehta requested a review from oandregal as a code owner December 1, 2026 14:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Fields /packages/fields

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Site Editor: Can't change the homepage's template when the theme has no front-page template

1 participant