Opened 9 years ago
Last modified 2 weeks ago
#36237 reviewing enhancement
Add filter for post statuses in quickedit
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.9 | Priority: | normal |
Severity: | normal | Version: | 4.4.2 |
Component: | Posts, Post Types | Keywords: | has-patch has-test-info |
Focuses: | administration | Cc: |
Description (last modified by )
To make changes to the quick edit status list, one has to use JS or action quick_edit_custom_box to add extra fields. In instances where some of the statuses need to be removed, JS is required.
I propose that the statuses in wp-admin/includes/class-wp-posts-list-table.php (line 1284-1300) be stored in an array then filtered using quick_edit_statuses before the array is iterated through to create the select options.
I'm available to submit a patch that does this
Attachments (2)
Change History (15)
#1
@
9 years ago
- Description modified (diff)
- Focuses administration added
- Keywords needs-patch added
- Summary changed from Add filter for ticket statuses in quickedit to Add filter for post statuses in quickedit
This ticket was mentioned in PR #9041 on WordPress/wordpress-develop by @SirLouen.
3 weeks ago
#6
Refreshing and Improving 36237.patch
I've code reviewed it and compared to the original version, there was a little difference on the conditionals (adding Private status type too early).
I am not sure if this was implemented by the original author on purpose @kakomap because there doesn't seem to be an explanation on this.
Apart from this, everything looks good, a nice DRY refactor, meant to include the filter accordingly.
I will be posting a test to this refresh
Automated could be done through Playwright. But I would leave this for further iterations. If anyone wants to add this feel free.
Trac ticket: [](https://core.trac.wordpress.org/ticket/36237)
#8
@
3 weeks ago
- Keywords has-test-info added; needs-testing removed
Test Report
Description
✅ This report validates that the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/9041.diff
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-One 2.5
- MU Plugins: None activated
- Plugins:
- Remove Draft from Quick Edit 1.0.0
- Test Reports 1.2.0
Testing Instructions
- Add the code provided in supplemental artifacts to a plugin, functions.php or wherever it can be executed
- Create a post or two
- Quick edit them and check if "Draft" status appears under the status Select. It should not appear.
Actual Results
- ✅ Issue resolved with patch.
Some extra Testing Results
- Given that the logic changes a bit, I've tested around
- ✅ Private only appears on bulk edit
- ✅ No Change appears only on bulk edit
- ✅ Scheduled, Future, Draft and Pending Review appear when the user has capabilities
- ✅ Testing with a user without capabilities (i.e. Contributor), Schedule, Private and Scheduled doesn't appear as expected, only Draft and Pending Review as expected.
Additional Notes
- I edited a little the code in the original patch because it was adding "Private" to members without the right capability
- Also added some docs to the filter
- Added a little note referencing this #63612 to avoid future confusion.
- Apart from this, the rest is the same. It brings a pretty nice refactor.
Supplemental Artifacts
Test code
function remove_draft_from_quick_edit_statuses( $statuses ) { if ( isset( $statuses['draft'] ) ) { unset( $statuses['draft'] ); } return $statuses; } add_filter( 'quick_edit_statuses', 'remove_draft_from_quick_edit_statuses' );
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
3 weeks ago
#10
@
3 weeks ago
Test Report
Description
This report validates whether the indicated patch works as expected.
Patch tested: https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/9041.diff
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.3
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.2
- MU Plugins: None activated
- Plugins:
- Test Quick Edit Filter
- Test Reports 1.2.0
Testing Instructions
- Create and activate the test plugin with the this provided filter code
- Create test posts with various statuses (Published, Draft, Pending Review)
- Navigate to Posts > All Posts in WordPress admin
- Test Quick Edit functionality:
- Hover over any post and click "Quick Edit"
- Verify that "Draft" status is removed from the Status dropdown
- Check that other statuses (Published, Pending Review) remain available
Actual Results
- ✅ Issue resolved with patch.
Additional Notes
- Filter works consistently across both Quick Edit and Bulk Edit interfaces
Supplemental Artifacts
Test Plugin Code:
<?php <?php /** * Plugin Name: Test Quick Edit Filter * Description: Tests the quick_edit_statuses filter */ function remove_draft_from_quick_edit_statuses( $statuses ) { if ( isset( $statuses['draft'] ) ) { unset( $statuses['draft'] ); } return $statuses; } add_filter( 'quick_edit_statuses', 'remove_draft_from_quick_edit_statuses' ); function add_custom_status_to_quick_edit( $statuses ) { $statuses['custom_status'] = __( 'Custom Status' ); return $statuses; } add_filter( 'quick_edit_statuses', 'add_custom_status_to_quick_edit' );
Visual Evidence: https://ibb.co/MD2rZPQW
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
2 weeks ago
#12
@
2 weeks ago
- Milestone set to 6.9
- Owner set to johnbillion
- Status changed from new to reviewing
Quick Edits