pre_count_many_users_posts
Filters whether to short-circuit performing the post counts.
When filtering, return an array of posts counts as strings, keyed by the user ID.
Использование
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[])
- Single post type or array of post types to check.
- $public_only(true|false)
- Whether to only return counts for public posts.
Список изменений
С версии 6.8.0 | Введена. |
Где вызывается хук
pre_count_many_users_posts
wp-includes/user.php 680
$pre = apply_filters( 'pre_count_many_users_posts', null, $users, $post_type, $public_only );