pre_count_users хук-фильтрWP 5.1.0

Filters the user count before queries are run.

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

Использование

add_filter( 'pre_count_users', 'wp_kama_pre_count_users_filter', 10, 3 );

/**
 * Function for `pre_count_users` filter-hook.
 * 
 * @param null|array $result   The value to return instead.
 * @param string     $strategy Optional. The computational strategy to use when counting the users. Accepts either 'time' or 'memory'.
 * @param int        $site_id  The site ID to count users for.
 *
 * @return null|array
 */
function wp_kama_pre_count_users_filter( $result, $strategy, $site_id ){

	// filter...
	return $result;
}
$result(null|массив)
The value to return instead.
По умолчанию: null to continue with the query
$strategy(строка)
Optional. The computational strategy to use when counting the users. Accepts either 'time' or 'memory'.
По умолчанию: 'time'
$site_id(int)
The site ID to count users for.

Список изменений

С версии 5.1.0 Введена.

Где вызывается хук

count_users()
pre_count_users
wp-includes/user.php 1246
$pre = apply_filters( 'pre_count_users', null, $strategy, $site_id );

Где используется хук в WordPress

Использование не найдено.