Repository navigation
Repair wp/5.7 branch Actions: Only read the template slug when a template exists in the templates REST controller - #84795
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Size Change: 0 B Total Size: 1.37 MB ℹ️ View Unchanged
|
c14781e to
58564df
Compare
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
58564df to
360b0b2
Compare
360b0b2 to
9a23e46
Compare
andrewserong
left a comment
There was a problem hiding this comment.
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.
… in the templates REST controller.
c88e72b to
9f91cbe
Compare
Part of #82936.
What?
In
WP_REST_Templates_Controller::prepare_item_for_database():$changes->post_name = $template->sluginto the two branches where$templateexists.themeparameter, sets thewp_themeterm from$request['theme']instead of$request['content'].Why?
When a template is created,
$templateisnull, and the method reads$template->slugbefore checking for that. On PHP 8 this is a warning, sotest_create_itemfails on thePHP 8.0jobs: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_namefrom the template, andcreate_item()already sets it from the request.The
wp_themefix was suggested in review. The tests don't cover it:test_create_itemdoesn't passtheme, 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