Skip to content

Repair wp/5.7 branch Actions: Only read the template slug when a template exists in the templates REST controller - #84795

Open
desrosj wants to merge 2 commits into
fix-actions-5.7/fix-widgets-controller-missing-namefrom
fix-actions-5.7/fix-templates-controller-null-template
Open

desrosj wants to merge 2 commits into
fix-actions-5.7/fix-widgets-controller-missing-namefrom
fix-actions-5.7/fix-templates-controller-null-template

Conversation

@desrosj

@desrosj desrosj commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Part of #82936.

What?

In WP_REST_Templates_Controller::prepare_item_for_database():

  • Moves $changes->post_name = $template->slug into the two branches where $template exists.
  • When a template is created with a theme parameter, sets the wp_theme term from $request['theme'] instead of $request['content'].

Why?

When a template is created, $template is null, and the method reads $template->slug before checking for that. On PHP 8 this is a warning, so test_create_item fails on the PHP 8.0 jobs:

Attempt to read property "slug" on null

These endpoints first shipped in WordPress 5.8. On this branch they exist only as plugin code in lib/, which isn't in any npm package and never reaches a WordPress 5.7 release. A small change here keeps the tests green, so security fixes for the packages WordPress 5.7 does ship can be verified reliably.

How?

This is the same change as 046c82f (#32176), applied by hand because that commit doesn't cherry-pick here. Updates still set post_name from the template, and create_item() already sets it from the request.

The wp_theme fix was suggested in review. The tests don't cover it: test_create_item doesn't pass theme, and nothing in the editor on this branch sends it. Before this change, a request that did would have assigned the template's content as its theme, leaving the new template unreachable.

Use of AI Tools

This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.

🤖 Generated with Claude Code

@desrosj desrosj added the [Type] Build Tooling Issues or PRs related to build tooling label Oct 15, 2026
@desrosj desrosj self-assigned this Oct 15, 2026
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c35e06f8-7377-4ac1-8bf0-9a782e356766

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 1.37 MB

ℹ️ View Unchanged
Filename Size
build/a11y/index.js 1.14 kB
build/annotations/index.js 3.77 kB
build/api-fetch/index.js 3.39 kB
build/autop/index.js 2.85 kB
build/blob/index.js 670 B
build/block-directory/index.js 9.1 kB
build/block-directory/style-rtl.css 997 B
build/block-directory/style.css 998 B
build/block-editor/index.js 124 kB
build/block-editor/style-rtl.css 12 kB
build/block-editor/style.css 12 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/audio/editor-rtl.css 59 B
build/block-library/blocks/audio/editor.css 59 B
build/block-library/blocks/audio/style-rtl.css 104 B
build/block-library/blocks/audio/style.css 104 B
build/block-library/blocks/block/editor-rtl.css 159 B
build/block-library/blocks/block/editor.css 159 B
build/block-library/blocks/button/editor-rtl.css 474 B
build/block-library/blocks/button/editor.css 474 B
build/block-library/blocks/button/style-rtl.css 451 B
build/block-library/blocks/button/style.css 451 B
build/block-library/blocks/buttons/editor-rtl.css 315 B
build/block-library/blocks/buttons/editor.css 315 B
build/block-library/blocks/buttons/style-rtl.css 362 B
build/block-library/blocks/buttons/style.css 363 B
build/block-library/blocks/calendar/style-rtl.css 206 B
build/block-library/blocks/calendar/style.css 206 B
build/block-library/blocks/categories/editor-rtl.css 84 B
build/block-library/blocks/categories/editor.css 83 B
build/block-library/blocks/categories/style-rtl.css 79 B
build/block-library/blocks/categories/style.css 79 B
build/block-library/blocks/code/style-rtl.css 90 B
build/block-library/blocks/code/style.css 90 B
build/block-library/blocks/columns/editor-rtl.css 190 B
build/block-library/blocks/columns/editor.css 190 B
build/block-library/blocks/columns/style-rtl.css 423 B
build/block-library/blocks/columns/style.css 422 B
build/block-library/blocks/cover/editor-rtl.css 395 B
build/block-library/blocks/cover/editor.css 393 B
build/block-library/blocks/cover/style-rtl.css 1.25 kB
build/block-library/blocks/cover/style.css 1.25 kB
build/block-library/blocks/embed/editor-rtl.css 484 B
build/block-library/blocks/embed/editor.css 484 B
build/block-library/blocks/embed/style-rtl.css 396 B
build/block-library/blocks/embed/style.css 396 B
build/block-library/blocks/file/editor-rtl.css 199 B
build/block-library/blocks/file/editor.css 199 B
build/block-library/blocks/file/style-rtl.css 247 B
build/block-library/blocks/file/style.css 247 B
build/block-library/blocks/freeform/editor-rtl.css 2.44 kB
build/block-library/blocks/freeform/editor.css 2.44 kB
build/block-library/blocks/gallery/editor-rtl.css 697 B
build/block-library/blocks/gallery/editor.css 698 B
build/block-library/blocks/gallery/style-rtl.css 1.06 kB
build/block-library/blocks/gallery/style.css 1.06 kB
build/block-library/blocks/group/editor-rtl.css 318 B
build/block-library/blocks/group/editor.css 317 B
build/block-library/blocks/group/style-rtl.css 58 B
build/block-library/blocks/group/style.css 58 B
build/block-library/blocks/heading/editor-rtl.css 128 B
build/block-library/blocks/heading/editor.css 128 B
build/block-library/blocks/heading/style-rtl.css 78 B
build/block-library/blocks/heading/style.css 78 B
build/block-library/blocks/html/editor-rtl.css 281 B
build/block-library/blocks/html/editor.css 282 B
build/block-library/blocks/image/editor-rtl.css 711 B
build/block-library/blocks/image/editor.css 710 B
build/block-library/blocks/image/style-rtl.css 479 B
build/block-library/blocks/image/style.css 479 B
build/block-library/blocks/latest-comments/editor-rtl.css 158 B
build/block-library/blocks/latest-comments/editor.css 157 B
build/block-library/blocks/latest-comments/style-rtl.css 266 B
build/block-library/blocks/latest-comments/style.css 269 B
build/block-library/blocks/latest-posts/editor-rtl.css 136 B
build/block-library/blocks/latest-posts/editor.css 136 B
build/block-library/blocks/latest-posts/style-rtl.css 518 B
build/block-library/blocks/latest-posts/style.css 518 B
build/block-library/blocks/list/editor-rtl.css 67 B
build/block-library/blocks/list/editor.css 67 B
build/block-library/blocks/list/style-rtl.css 65 B
build/block-library/blocks/list/style.css 65 B
build/block-library/blocks/media-text/editor-rtl.css 191 B
build/block-library/blocks/media-text/editor.css 191 B
build/block-library/blocks/media-text/style-rtl.css 532 B
build/block-library/blocks/media-text/style.css 530 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 432 B
build/block-library/blocks/navigation-link/editor-rtl.css 393 B
build/block-library/blocks/navigation-link/editor.css 393 B
build/block-library/blocks/navigation-link/style-rtl.css 699 B
build/block-library/blocks/navigation-link/style.css 696 B
build/block-library/blocks/navigation/editor-rtl.css 1.37 kB
build/block-library/blocks/navigation/editor.css 1.37 kB
build/block-library/blocks/navigation/style-rtl.css 182 B
build/block-library/blocks/navigation/style.css 182 B
build/block-library/blocks/nextpage/editor-rtl.css 392 B
build/block-library/blocks/nextpage/editor.css 392 B
build/block-library/blocks/paragraph/editor-rtl.css 109 B
build/block-library/blocks/paragraph/editor.css 109 B
build/block-library/blocks/paragraph/style-rtl.css 233 B
build/block-library/blocks/paragraph/style.css 233 B
build/block-library/blocks/post-author/editor-rtl.css 209 B
build/block-library/blocks/post-author/editor.css 209 B
build/block-library/blocks/post-author/style-rtl.css 184 B
build/block-library/blocks/post-author/style.css 184 B
build/block-library/blocks/post-comments-form/style-rtl.css 250 B
build/block-library/blocks/post-comments-form/style.css 250 B
build/block-library/blocks/post-content/editor-rtl.css 139 B
build/block-library/blocks/post-content/editor.css 139 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B
build/block-library/blocks/post-excerpt/editor.css 73 B
build/block-library/blocks/post-featured-image/editor-rtl.css 341 B
build/block-library/blocks/post-featured-image/editor.css 340 B
build/block-library/blocks/post-featured-image/style-rtl.css 100 B
build/block-library/blocks/post-featured-image/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 64 B
build/block-library/blocks/preformatted/style.css 64 B
build/block-library/blocks/pullquote/editor-rtl.css 183 B
build/block-library/blocks/pullquote/editor.css 183 B
build/block-library/blocks/pullquote/style-rtl.css 316 B
build/block-library/blocks/pullquote/style.css 316 B
build/block-library/blocks/query-loop/editor-rtl.css 90 B
build/block-library/blocks/query-loop/editor.css 89 B
build/block-library/blocks/query-loop/style-rtl.css 315 B
build/block-library/blocks/query-loop/style.css 317 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 121 B
build/block-library/blocks/query-pagination-numbers/editor.css 118 B
build/block-library/blocks/query-pagination/editor-rtl.css 270 B
build/block-library/blocks/query-pagination/editor.css 262 B
build/block-library/blocks/query-pagination/style-rtl.css 168 B
build/block-library/blocks/query-pagination/style.css 168 B
build/block-library/blocks/query/editor-rtl.css 160 B
build/block-library/blocks/query/editor.css 161 B
build/block-library/blocks/quote/editor-rtl.css 61 B
build/block-library/blocks/quote/editor.css 61 B
build/block-library/blocks/quote/style-rtl.css 170 B
build/block-library/blocks/quote/style.css 170 B
build/block-library/blocks/rss/editor-rtl.css 200 B
build/block-library/blocks/rss/editor.css 200 B
build/block-library/blocks/rss/style-rtl.css 290 B
build/block-library/blocks/rss/style.css 289 B
build/block-library/blocks/search/editor-rtl.css 165 B
build/block-library/blocks/search/editor.css 165 B
build/block-library/blocks/search/style-rtl.css 342 B
build/block-library/blocks/search/style.css 343 B
build/block-library/blocks/separator/editor-rtl.css 100 B
build/block-library/blocks/separator/editor.css 100 B
build/block-library/blocks/separator/style-rtl.css 235 B
build/block-library/blocks/separator/style.css 235 B
build/block-library/blocks/shortcode/editor-rtl.css 503 B
build/block-library/blocks/shortcode/editor.css 503 B
build/block-library/blocks/site-logo/editor-rtl.css 202 B
build/block-library/blocks/site-logo/editor.css 202 B
build/block-library/blocks/site-logo/style-rtl.css 116 B
build/block-library/blocks/site-logo/style.css 116 B
build/block-library/blocks/social-link/editor-rtl.css 163 B
build/block-library/blocks/social-link/editor.css 164 B
build/block-library/blocks/social-links/editor-rtl.css 704 B
build/block-library/blocks/social-links/editor.css 704 B
build/block-library/blocks/social-links/style-rtl.css 1.31 kB
build/block-library/blocks/social-links/style.css 1.32 kB
build/block-library/blocks/spacer/editor-rtl.css 300 B
build/block-library/blocks/spacer/editor.css 300 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/subhead/editor-rtl.css 99 B
build/block-library/blocks/subhead/editor.css 99 B
build/block-library/blocks/subhead/style-rtl.css 80 B
build/block-library/blocks/subhead/style.css 80 B
build/block-library/blocks/table/editor-rtl.css 486 B
build/block-library/blocks/table/editor.css 486 B
build/block-library/blocks/table/style-rtl.css 385 B
build/block-library/blocks/table/style.css 385 B
build/block-library/blocks/tag-cloud/editor-rtl.css 118 B
build/block-library/blocks/tag-cloud/editor.css 118 B
build/block-library/blocks/tag-cloud/style-rtl.css 94 B
build/block-library/blocks/tag-cloud/style.css 94 B
build/block-library/blocks/template-part/editor-rtl.css 674 B
build/block-library/blocks/template-part/editor.css 673 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 165 B
build/block-library/blocks/text-columns/style.css 165 B
build/block-library/blocks/verse/editor-rtl.css 62 B
build/block-library/blocks/verse/editor.css 62 B
build/block-library/blocks/verse/style-rtl.css 86 B
build/block-library/blocks/verse/style.css 86 B
build/block-library/blocks/video/editor-rtl.css 501 B
build/block-library/blocks/video/editor.css 501 B
build/block-library/blocks/video/style-rtl.css 193 B
build/block-library/blocks/video/style.css 193 B
build/block-library/common-rtl.css 1 kB
build/block-library/common.css 1 kB
build/block-library/editor-rtl.css 9.13 kB
build/block-library/editor.css 9.11 kB
build/block-library/index.js 144 kB
build/block-library/style-rtl.css 8.58 kB
build/block-library/style.css 8.59 kB
build/block-library/theme-rtl.css 742 B
build/block-library/theme.css 743 B
build/block-serialization-default-parser/index.js 1.87 kB
build/block-serialization-spec-parser/index.js 3.06 kB
build/blocks/index.js 48.5 kB
build/components/index.js 279 kB
build/components/style-rtl.css 15.6 kB
build/components/style.css 15.5 kB
build/compose/index.js 11.2 kB
build/core-data/index.js 16.8 kB
build/data-controls/index.js 830 B
build/data/index.js 8.85 kB
build/date/index.js 32.1 kB
build/deprecated/index.js 771 B
build/dom-ready/index.js 571 B
build/dom/index.js 5.04 kB
build/edit-navigation/index.js 11.1 kB
build/edit-navigation/style-rtl.css 937 B
build/edit-navigation/style.css 940 B
build/edit-post/index.js 306 kB
build/edit-post/style-rtl.css 6.77 kB
build/edit-post/style.css 6.75 kB
build/edit-site/index.js 24.3 kB
build/edit-site/style-rtl.css 4.01 kB
build/edit-site/style.css 4.01 kB
build/edit-widgets/index.js 20.1 kB
build/edit-widgets/style-rtl.css 3.17 kB
build/edit-widgets/style.css 3.17 kB
build/editor/editor-styles-rtl.css 544 B
build/editor/editor-styles.css 545 B
build/editor/index.js 41.8 kB
build/editor/style-rtl.css 3.88 kB
build/editor/style.css 3.88 kB
build/element/index.js 4.62 kB
build/escape-html/index.js 739 B
build/format-library/index.js 6.81 kB
build/format-library/style-rtl.css 635 B
build/format-library/style.css 636 B
build/hooks/index.js 2.27 kB
build/html-entities/index.js 624 B
build/i18n/index.js 3.73 kB
build/is-shallow-equal/index.js 701 B
build/keyboard-shortcuts/index.js 2.54 kB
build/keycodes/index.js 1.92 kB
build/list-reusable-blocks/index.js 3.13 kB
build/list-reusable-blocks/style-rtl.css 627 B
build/list-reusable-blocks/style.css 626 B
build/media-utils/index.js 5.33 kB
build/notices/index.js 1.84 kB
build/nux/index.js 3.41 kB
build/nux/style-rtl.css 729 B
build/nux/style.css 725 B
build/plugins/index.js 2.54 kB
build/primitives/index.js 1.41 kB
build/priority-queue/index.js 789 B
build/redux-routine/index.js 2.83 kB
build/reusable-blocks/index.js 2.95 kB
build/rich-text/index.js 13.6 kB
build/server-side-render/index.js 2.75 kB
build/shortcode/index.js 1.72 kB
build/token-list/index.js 1.26 kB
build/url/index.js 3.04 kB
build/viewport/index.js 1.85 kB
build/warning/index.js 1.14 kB
build/wordcount/index.js 1.23 kB

compressed-size-action

@desrosj
desrosj removed this pull request from stack #84797 October 16, 2026 00:33
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-templates-controller-null-template branch from c14781e to 58564df Compare October 16, 2026 00:33
@desrosj
desrosj added this pull request to stack #84872 October 16, 2026 00:34
@desrosj
desrosj marked this pull request as ready for review October 16, 2026 01:18
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

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: desrosj <desrosj@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

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

@desrosj
desrosj removed this pull request from stack #84872 October 16, 2026 15:52
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-templates-controller-null-template branch from 58564df to 360b0b2 Compare October 16, 2026 15:52
@desrosj
desrosj added this pull request to stack #84945 October 16, 2026 15:53
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-templates-controller-null-template branch from 360b0b2 to 9a23e46 Compare October 19, 2026 17:09

@andrewserong andrewserong 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.

The change looks good to me! Just left an optional nit about if we should also roll in one other detail from the PR this hand cherry-picks.

Since these fixes are about ensuring the overall release can still pass automated testing, the comment is entirely optional, and I think this PR would be fine to land either way.

Comment thread lib/full-site-editing/class-wp-rest-templates-controller.php Outdated
@desrosj
desrosj removed this pull request from stack #84945 October 21, 2026 19:48
@desrosj
desrosj added this pull request to stack #85354 October 21, 2026 19:48
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-templates-controller-null-template branch from c88e72b to 9f91cbe Compare October 23, 2026 13:59

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

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants