pre_count_many_users_posts filter-hookWP 6.8.0

Filters whether to short-circuit performing the post counts.

When filtering, return an array of posts counts as strings, keyed by the user ID.

Usage

add_filter( 'pre_count_many_users_posts', 'wp_kama_pre_count_many_users_posts_filter', 10, 4 );

/**
 * Function for `pre_count_many_users_posts` filter-hook.
 * 
 * @param string[]|null   $count       The post counts. Return a non-null value to short-circuit.
 * @param int[]           $users       Array of user IDs.
 * @param string|string[] $post_type   Single post type or array of post types to check.
 * @param bool            $public_only Whether to only return counts for public posts.
 *
 * @return string[]|null
 */
function wp_kama_pre_count_many_users_posts_filter( $count, $users, $post_type, $public_only ){

	// filter...
	return $count;
}
$count(string[]|null)
The post counts. Return a non-null value to short-circuit.
$users(int[])
Array of user IDs.
$post_type(string|string[])
Single post type or array of post types to check.
$public_only(true|false)
Whether to only return counts for public posts.

Changelog

Since 6.8.0 Introduced.

Where the hook is called

count_many_users_posts()
pre_count_many_users_posts
wp-includes/user.php 680
$pre = apply_filters( 'pre_count_many_users_posts', null, $users, $post_type, $public_only );

Where the hook is used in WordPress

Usage not found.