Repository navigation
XML-RPC: Honor menu_order when creating and editing posts - #14189
salvatorecorsi wants to merge 1 commit into
Conversation
Include menu_order in the existing post field whitelist and document the accepted parameter. Add regression coverage for posts and pages, zero and negative order values, and preservation when omitted from an edit. See https://core.trac.wordpress.org/ticket/40863.
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The full PHPUnit workflow passed all 64 PHP/database configurations, including multisite and memcached. E2E, build, PHPStan, compatibility and coding standards also passed. The five failed upgrade jobs in this run failed during tool setup: Could a maintainer rerun only those failed jobs? The targeted |
wp.newPostandwp.editPostsilently discard a suppliedmenu_order:_insert_post()intersects the content struct with defaults that do not include this field. For example, creating a page withmenu_order: 5stores 0, and editing a page whose order is 10 tomenu_order: 0leaves 10.Add
menu_orderwith a default of 0 to the existing whitelist and document the parameter. The existing edit merge preserves the stored order when it is omitted. Add integration tests for posts and pages, positive/zero/negative values, and an edit that omits the field.This follows the whitelist approach in the earlier patch by iworks on the ticket, focusing on the
menu_orderbug confirmed by the reporter.Trac ticket: https://core.trac.wordpress.org/ticket/40863
Reproduction
wp.newPostas an editor withpost_title: "Menu order test",post_type: "page", andmenu_order: 5. The saved order should be 5.menu_orderis 10 and callwp.editPostwithmenu_order: 0. The saved order should be 0.post_titleand confirm that its saved order is preserved.Validation
wp.newPosttests had 3 failures in 4 cases, and thewp.editPosttests had 4 failures in 5 cases.PreparedSQL.NotPreparedwarning also reproduced on unchanged trunk. The error-only scan passed.git diff --checkpassed.The local serialized PHPUnit runner invokes
php vendor/bin/phpunit -c phpunit.xml.dist --filter '^Tests_XMLRPC_'. Coding standards and compatibility usedphp vendor/bin/phpcs --standard=phpcs.xml.dist --parallel=1 <three changed files>andphp vendor/bin/phpcs --standard=phpcompat.xml.dist --parallel=1 <three changed files>.GitHub CI
The full PHPUnit workflow passed all 64 configured PHP/database combinations, including single-site, multisite and memcached. Both E2E configurations, all six build configurations, PHPStan, PHP compatibility and coding standards also passed.
Five upgrade checks failed during WP-CLI installation:
setup-phpreportedCould not setup wp-cli, then the initialwp core downloadfailed withwp: command not found(exit 127), before executing the modified PR implementation. These setup failures leave overall CI failing; their logs and the passing PHPUnit matrix are recorded above for review.Use of AI Tools
AI assistance: Yes
Tool(s): OpenAI Codex
Model(s): GPT-6
Used for: Ticket investigation, implementation, regression tests, local validation, this description, and an independent automated review. No human review is claimed; this PR is submitted for contributor and maintainer review.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.