Users: Introduce the `users_list_table_query_args` filter, for modifying the `WP_User_Query` arguments used within the `prepare_items()` methods in the users list tables.

The current list table is passed as a second parameter, `$this`, and can take the form of either a `WP_Users_List_Table` or `WP_MS_Users_List_Table` instance depending on the context in which the filter was evaluated.

Props juliobox for the initial patch.
Fixes #25360.


git-svn-id: https://develop.svn.wordpress.org/trunk@34796 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes 2015-10-03 07:23:20 +00:00
parent da083f165d
commit 433f6600c0
2 changed files with 14 additions and 0 deletions

View File

@ -75,6 +75,9 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
/** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
$args = apply_filters( 'users_list_table_query_args', $args, $this );
// Query the user IDs for this page
$wp_user_search = new WP_User_Query( $args );

View File

@ -107,6 +107,17 @@ class WP_Users_List_Table extends WP_List_Table {
if ( isset( $_REQUEST['order'] ) )
$args['order'] = $_REQUEST['order'];
/**
* Filter the query arguments used to retrieve users for the current users list table.
*
* @since 4.4.0
*
* @param array $args Arguments passed to WP_User_Query to retrieve items for the current
* users list table.
* @param mixed $this The current WP_Users_List_Table or WP_MS_Users_List_Table instance.
*/
$args = apply_filters( 'users_list_table_query_args', $args, $this );
// Query the user IDs for this page
$wp_user_search = new WP_User_Query( $args );