get_usernumposts хук-фильтрWP 2.7.0

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.

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

count_user_posts()
get_usernumposts
wp-includes/user.php 573
return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );

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

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