Posts, Post Types: Preserve comment/ping status in Quick Edit when the control isn't rendered - #12925
Posts, Post Types: Preserve comment/ping status in Quick Edit when the control isn't rendered#12925irozum wants to merge 2 commits into
Conversation
…upporting post types
…e field isn't rendered
|
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. |
wp_ajax_inline_save()unconditionally defaultscomment_status/ping_statustoclosedwhenever those fields are absent from the Quick Edit POST data, on the assumption that an absent value means the checkbox was unchecked. That assumption breaks for post types that don't supportcomments/trackbacksat all (e.g.page, which supportscommentsbut nottrackbacks): the corresponding checkbox is never rendered in the Quick Edit form, so the field is always absent, and every Quick Edit save on such a post type silently resets itsping_statustoclosedeven if it was previouslyopen.This fixes it by falling back to the post's current
comment_status/ping_status(already fetched into$postearlier in the function) instead of hardcodingclosed, so a status that Quick Edit has no control for is left untouched rather than being overwritten. This also fixes the same issue for Bulk Edit's "— No Change —" option, which submits the same empty value through the same code path.Added a PHPUnit test reproducing the bug against the
pagepost type and assertingping_statusis preserved across a Quick Edit save.Trac ticket: https://core.trac.wordpress.org/ticket/31977
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Implementation, tests, and PR description. Reviewed by irozum.
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.