#47685 closed enhancement (fixed)
Allow developers to filter the authors list on quick edit dropdown
Reported by: | Mista-Flo | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Quick/Bulk Edit | Keywords: | has-patch commit has-dev-note |
Focuses: | administration | Cc: |
Description
Hello,
I want to find a way to filter the author list displayed in quick edit dropdown. I basically want to remove some roles of this list.
But there is currently no hook so I have to go through the wp_dropdown_users
function, then use wp_dropdown_users_args
filter, but this functions is also called on a lot of other parts of the backend, so I have to be sure that I'm only affecting the quick edit query.
So it would be nice to just add a particular filter for this quick edit author dropdown.
Attachments (4)
Change History (19)
#2
@
5 years ago
- Milestone changed from Awaiting Review to 5.3
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
#4
@
5 years ago
- Keywords commit removed
- Milestone changed from 5.3 to Future Release
With 5.3 Beta 1 being released today, I’m punting this to Future Release
.
#5
@
4 years ago
Hey @SergeyBiryukov I have updated my patch so it will be applied with last version of trunk. Hopefully it can now be part of 5.6 release :)
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
4 years ago
#8
@
4 years ago
- Keywords needs-dev-note added
New filter. Tagging for a mention in the general dev note.
This ticket was mentioned in Slack in #core by metalandcoffee. View the logs.
4 years ago
@
4 years ago
Minor refresh to improve the filter docblock and rename it quick_edit_dropdown_authors_args
to coincide with the existing quick_edit_dropdown_pages_args
filter.
#10
@
4 years ago
- Keywords needs-testing added
Thanks for the enhancement @Mista-Flo I've refreshed your patch in 47685.3.diff to slightly improve the docblock and rename the filter quick_edit_dropdown_authors_args
(previously quick_edit_authors_query_args
) to coincide with the existing quick_edit_dropdown_pages_args
filter.
I think this just needs some testing on the latest patch and it's ready for committers review.
@
4 years ago
Screen capture showing before filter is applied and when filtering 'rolein' => array( 'editor', 'administrator' ).
#11
@
4 years ago
- Keywords commit added; needs-testing removed
Tested with this code:
<?php add_filter( 'quick_edit_dropdown_authors_args', function ( $users ) { $users['role__in'] = [ 'editor', 'administrator' ]; $users['who'] = ''; $users['hide_if_only_one_author'] = false; return $users; } );
Works as expected.
Removing needs-testing
. This ticket is ready for commit
.
#12
@
4 years ago
Thanks for the test @hellofromTonya, looks good to me as well, thanks for the refresh @garrett-eclipse
@SergeyBiryukov Can this one be moved forward for version 5.3 Beta 1 tomorrow? The patch looks clean. Would this need a small Dev Note as well?