Users: Add the pre_count_users
filter.
Props spacedmonkey. Fixes #43693. git-svn-id: https://develop.svn.wordpress.org/trunk@44473 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1e35159a2d
commit
0311c0d083
@ -882,6 +882,24 @@ function count_users( $strategy = 'time', $site_id = null ) {
|
||||
if ( ! $site_id ) {
|
||||
$site_id = get_current_blog_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the user count before queries are run. Return a non-null value to cause count_users()
|
||||
* to return early.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*
|
||||
* @param null|string $result Default null.
|
||||
* @param string $strategy Optional. The computational strategy to use when counting the users.
|
||||
* Accepts either 'time' or 'memory'. Default 'time'.
|
||||
* @param int|null $site_id Optional. The site ID to count users for. Defaults to the current site.
|
||||
*/
|
||||
$pre = apply_filters( 'pre_count_users', null, $strategy, $site_id );
|
||||
|
||||
if ( null !== $pre ) {
|
||||
return $pre;
|
||||
}
|
||||
|
||||
$blog_prefix = $wpdb->get_blog_prefix( $site_id );
|
||||
$result = array();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user