Posts: Prevent private posts from becoming sticky in Quick and Bulk Edit - #12856
Posts: Prevent private posts from becoming sticky in Quick and Bulk Edit#12856himanshupathak95 wants to merge 8 commits into
Conversation
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 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. |
SainathPoojary
left a comment
There was a problem hiding this comment.
Thanks for the PR, @himanshupathak95!
I tested this locally and it works perfectly, private posts are no longer be sticky during Quick or Bulk Edit as expected.
I just left two minor inline comments to help strengthen the PR:
- Code clarity: A request for a brief inline comment explaining in post.php.
- Testing: A suggestion to add a regression test for non-private posts to ensure that path remains protected.
…ing the sticky UI in bulk and inline editors
247ab89 to
f92ddb3
Compare
|
The failure in that single test looks unrelated, but I'm looking to see the cause. |
Trac ticket: https://core.trac.wordpress.org/ticket/39946
Private posts are only visible to authorized users and do not appear in public front page queries (
is_home()). Consequently, private posts cannot and should not be made sticky.While single post editing (
edit_post()) correctly enforces this constraint by unsticking private posts,wp-admin/edit.phppreviously allowed private posts to become sticky via Bulk Edit both in the UI and in thebulk_edit_posts()backend handler. Quick Edit UI also left the sticky checkbox active when Private status was checked.This PR resolves ticket #39946 by:
bulk_edit_posts()insrc/wp-admin/includes/post.phpto automatically callunstick_post()whenever a post's status is or becomesprivate.src/js/_enqueues/admin/inline-edit-post.jsto disable and reset the "Sticky" dropdown when "Private" status is selected in Bulk Edit.inline-edit-post.jsto delegate event handling ontable.widefatso Quick Edit rows properly uncheck and disable the "Sticky" checkbox when "Private" is selected.tests/phpunit/tests/admin/includesPost.php.Testing Instructions
wp-admin/edit.php).npm run test:php -- --filter=Tests_Admin_IncludesPost.