pre_count_users WordPress Filter Hook
The pre_count_users hook is used to filter the number of users that should be returned by a query. This is useful for optimizing performance when a query is expected to return a large number of results.
apply_filters( 'pre_count_users', null|string $result , string $strategy , int|null $site_id ) #
Filters the user count before queries are run.
Description
Return a non-null value to cause count_users() to return early.
Parameters
- $result
(null|string)The value to return instead. Default null to continue with the query.
- $strategy
(string) The computational strategy to use when counting the users. Accepts either 'time' or 'memory'. Default 'time'.
- $site_id
(int|null) The site ID to count users for. Defaults to the current site.
Source
File: wp-includes/user.php
Changelog
Version | Description |
---|---|
5.1.0 | Introduced. |