WordPress.org

Make WordPress Core

Changeset 34692


Ignore:
Timestamp:
09/29/2015 03:39:26 PM (4 years ago)
Author:
DrewAPicture
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user-functions.php

    r34446 r34692  
    923923    $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) );
    924924    $query_args['fields'] = array( 'ID', 'user_login', $show );
     925
     926    /**
     927     * Filter the arguments for user drop-down arguments before being passed into the query.
     928     *
     929     * @since 4.4.0
     930     *
     931     * @param array $query_args The default arguments for wp_dropdown_users().
     932     */
     933    $query_args = apply_filters( 'wp_dropdown_users_args', $query_args );
     934
    925935    $users = get_users( $query_args );
    926936
Note: See TracChangeset for help on using the changeset viewer.