From 077854484d0ffb334472aae39ed0ea139438e83e Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Tue, 29 Sep 2015 15:39:26 +0000 Subject: [PATCH] Users: Introduce the `wp_dropdown_users_args` filter, making it possible to filter the arguments for `wp_dropdown_users()` before the query is run. The 'name' argument (or the `WP_Screen` object if in the admin) can be used to help target specific instances of `wp_dropdown_users()` via this hook. Props norcross. See #19867. git-svn-id: https://develop.svn.wordpress.org/trunk@34692 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/user-functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wp-includes/user-functions.php b/src/wp-includes/user-functions.php index 39949bee7f..225a0bc128 100644 --- a/src/wp-includes/user-functions.php +++ b/src/wp-includes/user-functions.php @@ -922,6 +922,16 @@ function wp_dropdown_users( $args = '' ) { $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) ); $query_args['fields'] = array( 'ID', 'user_login', $show ); + + /** + * Filter the arguments for user drop-down arguments before being passed into the query. + * + * @since 4.4.0 + * + * @param array $query_args The default arguments for wp_dropdown_users(). + */ + $query_args = apply_filters( 'wp_dropdown_users_args', $query_args ); + $users = get_users( $query_args ); $output = '';