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:
parent
da083f165d
commit
433f6600c0
@ -75,6 +75,9 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||||||
|
|
||||||
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
|
$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
|
// Query the user IDs for this page
|
||||||
$wp_user_search = new WP_User_Query( $args );
|
$wp_user_search = new WP_User_Query( $args );
|
||||||
|
|
||||||
|
@ -107,6 +107,17 @@ class WP_Users_List_Table extends WP_List_Table {
|
|||||||
if ( isset( $_REQUEST['order'] ) )
|
if ( isset( $_REQUEST['order'] ) )
|
||||||
$args['order'] = $_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
|
// Query the user IDs for this page
|
||||||
$wp_user_search = new WP_User_Query( $args );
|
$wp_user_search = new WP_User_Query( $args );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user