pre_count_many_users_posts
Filter HookDescription
Filters whether to short-circuit performing the post counts. When filtering, return an array of posts counts as strings, keyed by the user ID.Hook Information
File Location |
wp-includes/user.php
View on GitHub
|
Hook Type | Filter |
Line Number | 680 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]|null
|
$count
|
The post counts. Return a non-null value to short-circuit. |
int[]
|
$users
|
Array of user IDs. |
string|string[]
|
$post_type
|
Single post type or array of post types to check. |
bool
|
$public_only
|
Whether to only return counts for public posts. |
Usage Examples
Basic Usage
<?php
// Hook into pre_count_many_users_posts
add_filter('pre_count_many_users_posts', 'my_custom_filter', 10, 4);
function my_custom_filter($count, $users, $post_type, $public_only) {
// Your custom filtering logic here
return $count;
}
Source Code Context
wp-includes/user.php:680
- How this hook is used in WordPress core
<?php
675 * @param string[]|null $count The post counts. Return a non-null value to short-circuit.
676 * @param int[] $users Array of user IDs.
677 * @param string|string[] $post_type Single post type or array of post types to check.
678 * @param bool $public_only Whether to only return counts for public posts.
679 */
680 $pre = apply_filters( 'pre_count_many_users_posts', null, $users, $post_type, $public_only );
681 if ( null !== $pre ) {
682 return $pre;
683 }
684
685 $userlist = implode( ',', array_map( 'absint', $users ) );
PHP Documentation
<?php
/**
* Filters whether to short-circuit performing the post counts.
*
* When filtering, return an array of posts counts as strings, keyed
* by the user ID.
*
* @since 6.8.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/user.php
Related Hooks
Related hooks will be displayed here in future updates.