Skip to content

Site Editor: template and parent fields are bulk editable - #85947

Draft
oandregal wants to merge 4 commits into
trunkfrom
add/bulk-edit-template-parent
Draft

oandregal wants to merge 4 commits into
trunkfrom
add/bulk-edit-template-parent

Conversation

@oandregal

Copy link
Copy Markdown
Member

What?

Adds the Template and Parent fields to bulk editing in the site editor's Pages list, in both the site editor and the extensible site editor.

Why?

Selecting several pages and choosing "Bulk edit" only offered Status, Date, Author, and Discussion.

The fields are limited by a hardcoded allowlist (fieldsWithBulkEditSupport), and Template and Parent were never on it, because both edit controls assumed a single post: the template control needs the post to work out its default template and whether it can switch, and the parent control uses the post's id to hide the post itself and its children from the options.

How?

  • Core fields: a record without an id now stands for several posts edited at once.
    • Template: the control offers every template of the post type, selects nothing until one is picked, and labels the default option "Default template", since each post keeps its own default.
    • Parent: the control no longer sends exclude / parent_exclude when there is no id.
    • Both views render nothing until a value is picked, instead of showing "None" or an empty default label.
  • Quick edit modal (packages/edit-site and routes/post-list):
    • template and parent join fieldsWithBulkEditSupport.
    • In bulk mode the form data includes the post type, which both fields need.
    • When saving, the template is not applied to the front page or the posts page, whose template comes from the reading settings. This matches the single-page modal, where the field is read-only for them.
    • Picking one of the selected pages as the parent makes it the parent of the others, and that page keeps its own parent.

The template field still doesn't appear for classic themes in bulk mode, the same as for a single page here: classic templates (available_templates) come from the post editor's settings, which the site editor doesn't load.

Testing Instructions

  1. With a block theme active, go to Appearance > Editor > Pages.
  2. Select two or more pages and choose "Bulk edit".
  3. Check that Template and Parent are listed and show no value.
  4. Pick a template and a parent page, then click "Done".
  5. Check that every selected page has the new template and parent.
  6. Repeat with the front page or the posts page in the selection: it gets the new parent but keeps its template.
  7. Repeat picking one of the selected pages as the parent: the other pages become its children, and its own parent doesn't change.
  8. Repeat steps 2–5 in the extensible site editor (enable the gutenberg-extensible-site-editor experiment).
  9. Open "Quick edit" for a single page and check that Template and Parent behave as before.

Testing Instructions for Keyboard

  1. In the Pages list, move to the selection checkboxes with Tab and select two pages with Space.
  2. Open the bulk actions and choose "Bulk edit" with Enter.
  3. Tab to Template, press Enter to open it, pick a template with the arrow keys and Enter.
  4. Tab to Parent, press Enter, type to search, pick a page with the arrow keys and Enter.
  5. Tab to "Done" and press Enter.

Use of AI Tools

This PR was written with Claude Code (Claude Opus 5.5), which traced the bulk edit allowlist, implemented the changes, and drafted this description. I reviewed the changes and take responsibility for them.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 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: oandregal <oandregal@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@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.

📦 Bundle size

Size Change: +153 B (0%)

Total Size: 8.73 MB

📦 View Changed
Filename Size Change
build/modules/core-fields/post_type_supports.min.js 82.5 kB +75 B (+0.09%)
build/scripts/edit-site/index.min.js 384 kB +78 B (+0.02%)

669fa1f Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric e5dd98a trunk % Change
timeToFirstByte 43.4 ms +14.06% -3.69% 44.6 ms +3.81% -6.05% -2.69%
largestContentfulPaint 68 ms +5.88% -2.94% 72 ms +5.56% -5.56% -5.56%
lcpMinusTtfb 24.4 ms +23.57% -8.61% 27.25 ms +15.23% -17.61% -10.46%
wpBeforeTemplate 22.36 ms +16.1% -2.24% 23.19 ms +4.05% -4.74% -3.58%
wpTemplate 17.77 ms +3.04% -6.02% 17.87 ms +1.45% -6.55% -0.56%
wpTotal 40.1 ms +14.19% -3.99% 41.16 ms +4.37% -5.95% -2.58%
wpMemoryUsage 7.75 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric e5dd98a trunk % Change
timeToFirstByte 36.3 ms +15.29% -3.72% 34.95 ms +12.59% -1.72% 3.86%
largestContentfulPaint 64 ms +12.5% -0% 64 ms +6.25% -0% 0%
lcpMinusTtfb 29.2 ms +1.37% -2.4% 28.55 ms +2.98% -4.2% 2.28%
wpBeforeTemplate 19.91 ms +16.88% -2.61% 19.14 ms +9.67% -1.15% 4.02%
wpTemplate 13.49 ms +4.89% -5.34% 12.92 ms +7.28% -2.17% 4.41%
wpTotal 33.53 ms +13% -3.94% 32.23 ms +12.6% -2.08% 4.03%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric e5dd98a trunk % Change
mediaProcessingJpeg 331.01 ms +0.19% -1.95% 322.44 ms +0.8% -0.84% 2.66%
mediaProcessingAvif 4844.76 ms +0.22% -0.42% 4877.66 ms +0.54% -0.14% -0.67%
mediaProcessingJpegToAvif 3394.78 ms +0.15% -0.25% 3401.44 ms +0.14% -0.4% -0.2%

media-upload

Metric e5dd98a trunk % Change
jpegUploadProcessing 1468.8 ms +1.05% -1.64% 1448.07 ms +0.21% -0.7% 1.43%
pngUploadProcessing 241.68 ms +4.27% -4.73% 236.54 ms +3.91% -4.74% 2.17%
largeJpegUploadProcessing 1436.04 ms +0.61% -0.15% 1451.04 ms +0.1% -0.21% -1.03%
multipleImageUploadProcessing 1507.88 ms +11.43% -0.35% 1489.37 ms +1.32% -0.24% 1.24%

post-editor

Metric e5dd98a trunk % Change
serverResponse 418.38 ms +0.94% -10.95% 421.26 ms +2.31% -11.2% -0.68%
firstPaint 451.05 ms +7.1% -11.37% 401.75 ms +10.72% -3.13% 12.27%
domContentLoaded 820.85 ms +11.31% -1.22% 815.89 ms +5.31% -0.82% 0.61%
loaded 822 ms +11.28% -1.24% 817.03 ms +5.31% -0.82% 0.61%
firstContentfulPaint 469.92 ms +17.69% -4.26% 460.24 ms +9.57% -1.36% 2.1%
firstBlock 2201.6 ms +5.36% -2.87% 2195.57 ms +0.87% -1.9% 0.27%
type 17.47 ms +5.84% -6.18% 18.18 ms +7.81% -11.99% -3.91%
typeWithoutInspector 17.05 ms +9.79% -8.45% 18.98 ms +5.11% -17.18% -10.17%
typeWithTopToolbar 23.15 ms +3.46% -8.64% 23.15 ms +6.48% -5.66% 0%
typeContainer 7.74 ms +10.72% -7.62% 8.3 ms +7.59% -11.2% -6.75%
focus 111.98 ms +4.4% -5.3% 110.01 ms +2.06% -3.69% 1.79%
firstFocus 266.55 ms +0% -0% 267.02 ms +0% -0% -0.18%
selectAll 376.04 ms +4.26% -1.9% 373.25 ms +0.16% -1.82% 0.75%
undo 28.84 ms +10.26% -2.57% 29.58 ms +5.31% -5.65% -2.5%
listViewOpen 39.02 ms +9.23% -7.07% 39.66 ms +6.48% -4.36% -1.61%
inserterOpen 43.81 ms +14.77% -14.49% 40.55 ms +10.97% -8.31% 8.04%
inserterHover 11.44 ms +12.59% -8.83% 11.62 ms +5.16% -7.49% -1.55%
inserterSearch 8.38 ms +4.65% -5.25% 8.17 ms +11.51% -2.08% 2.57%
loadPatterns 665.15 ms +4.16% -9.16% 638.45 ms +7.98% -3.28% 4.18%
wpTotal 407.38 ms +0.96% -11.34% 410.11 ms +2.07% -11.47% -0.67%
wpMemoryUsage 14.81 MB +0% -0% 14.76 MB +0% -0% 0.33%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric e5dd98a trunk % Change
serverResponse 390.46 ms +3.86% -5.79% 407.79 ms +0.41% -7.46% -4.25%
firstPaint 441.65 ms +4.26% -2.27% 407.31 ms +4.69% -6.2% 8.43%
domContentLoaded 821.33 ms +1.55% -1.63% 848.03 ms +1.84% -0.84% -3.15%
loaded 822.5 ms +1.5% -1.67% 848.96 ms +1.84% -0.8% -3.12%
firstContentfulPaint 460.47 ms +2.52% -1.12% 476.04 ms +1% -1.57% -3.27%
firstBlock 2396.18 ms +0.87% -1.56% 2532.9 ms +0.26% -1.05% -5.4%
type 19.19 ms +6.46% -9.95% 19.42 ms +9.73% -9.11% -1.18%
navigate 118.35 ms +0.73% -0.65% 124.3 ms +0.98% -7.44% -4.79%
loadPatterns 1479.31 ms +3.94% -6.26% 1518.96 ms +6.11% -6.06% -2.61%
loadPages 946.35 ms +0.38% -1.15% 950.43 ms +2.53% -1.62% -0.43%
wpTotal 380.79 ms +3.94% -5.89% 398.01 ms +0.41% -7.8% -4.33%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

669fa1f Run

@oandregal oandregal self-assigned this Oct 29, 2026
@github-actions github-actions Bot added [Package] Edit Site /packages/edit-site [Package] Fields /packages/fields labels Oct 29, 2026
@oandregal oandregal added [Type] Bug An existing feature does not function as intended [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta and removed [Package] Edit Site /packages/edit-site [Package] Fields /packages/fields labels Oct 29, 2026
@oandregal

Copy link
Copy Markdown
Member Author

cc @verofasulo

@jameskoster

Copy link
Copy Markdown
Contributor

Makes sense to me! :)

@oandregal oandregal removed the Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Nov 26, 2026
@oandregal
oandregal force-pushed the add/bulk-edit-template-parent branch from 2deef01 to 4f20c19 Compare November 26, 2026 11:36
@github-actions github-actions Bot added [Package] Edit Site /packages/edit-site [Package] Fields /packages/fields labels Nov 26, 2026
@oandregal
oandregal marked this pull request as ready for review November 26, 2026 11:42
Copilot AI balanced review requested due to automatic review settings November 26, 2026 11:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

oandregal and others added 2 commits November 26, 2026 17:14
… once

A record without an id stands for several posts edited at once. The
template field then offers every template of the post type, selects none
until one is picked, and labels the default option generically; the
parent field drops its self-exclusion. Both views show nothing until a
value is picked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the template and parent fields to the fields bulk editing shows, in
both site editors. Saving leaves the template of the front page and the
posts page alone, as their template comes from the reading settings, and
a selected page picked as the parent becomes the parent of the others.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oandregal
oandregal force-pushed the add/bulk-edit-template-parent branch from 4f20c19 to 9adfdb4 Compare November 26, 2026 16:16
Comment on lines +92 to +94
const canSwitchTemplateOf = ( id: string ) =>
String( id ) !== postsPageId && String( id ) !== frontPageId;
const canSwitchTemplate = postId.some( canSwitchTemplateOf );

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm uncomfortable with all this logic in the QuickEditModal (pre-existing to this PR). The goal is to have none. Fields should be standalone so that any third-party field can do the same things any core field does.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm fixing this at #87541 that also closes two other issues I ran into #87539 and #87540

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

More of this at #87547

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

More about status #87552

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Found more issues with existing bulk actions for status #87555

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ended up creating #87556

oandregal and others added 2 commits November 26, 2026 17:54
The template field is disabled for the front page and the posts page,
whose template comes from the reading settings, and the parent field for
a page that would be its own parent. A caller editing several posts at
once can ask each post, instead of knowing about either field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The quick edit modal no longer knows about the template and parent
fields. Saving drops the edit of any field disabled for a post once
edited, and editing several posts makes a field read-only when it is
disabled for all of them. Both site editors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Package] Edit Site /packages/edit-site [Package] Fields /packages/fields [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants