get_usernumposts
Filters the number of posts a user has written.
Использование
add_filter( 'get_usernumposts', 'wp_kama_get_usernumposts_filter', 10, 4 ); /** * Function for `get_usernumposts` filter-hook. * * @param int $count The user's post count. * @param int $userid User ID. * @param string|array $post_type Single post type or array of post types to count the number of posts for. * @param bool $public_only Whether to limit counted posts to public posts. * * @return int */ function wp_kama_get_usernumposts_filter( $count, $userid, $post_type, $public_only ){ // filter... return $count; }
- $count(int)
- The user's post count.
- $userid(int)
- User ID.
- $post_type(строка|массив)
- Single post type or array of post types to count the number of posts for.
- $public_only(true|false)
- Whether to limit counted posts to public posts.
Список изменений
С версии 2.7.0 | Введена. |
С версии 4.1.0 | Added $post_type argument. |
С версии 4.3.1 | Added $public_only argument. |
Где вызывается хук
get_usernumposts
wp-includes/user.php 603
return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );