wppaste
WordPress

apply_filters( 'pre_count_users', null|array $result, string $strategy, int $site_id )

Since
5.1.0
Filters the user count before queries are run.

Description

Return a non-null value to cause count_users() to return early.

Compatibility

WordPress
since 5.1.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$resultnull|array
The value to return instead. Default null to continue with the query.
$strategystring
The computational strategy to use when counting the users.
Accepts either 'time' or 'memory'. Default 'time'.
$site_idint
The site ID to count users for.

Where this hook fires · 1

  • wp-includes/user.php:1278count_users()

Source code

	 *	 * @param null|array $result   The value to return instead. Default null to continue with the query.	 * @param string     $strategy Optional. The computational strategy to use when counting the users.	 *                             Accepts either 'time' or 'memory'. Default 'time'.	 * @param int        $site_id  The site ID to count users for.	 */	$pre = apply_filters( 'pre_count_users', null, $strategy, $site_id ); 	if ( null !== $pre ) {		return $pre;	} 	$blog_prefix = $wpdb->get_blog_prefix( $site_id );

Changelog

Introduced in 5.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.