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.


Top ↑

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.


Top ↑

Source

File: wp-includes/user.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More