wp_count_posts хук-фильтрWP 3.7.0

Filters the post counts by status for the current post type.

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

add_filter( 'wp_count_posts', 'wp_kama_count_posts_filter', 10, 3 );

/**
 * Function for `wp_count_posts` filter-hook.
 * 
 * @param stdClass $counts An object containing the current post_type's post counts by status.
 * @param string   $type   Post type.
 * @param string   $perm   The permission to determine if the posts are 'readable' by the current user.
 *
 * @return stdClass
 */
function wp_kama_count_posts_filter( $counts, $type, $perm ){

	// filter...
	return $counts;
}
$counts(stdClass)
An object containing the current post_type's post counts by status.
$type(строка)
Post type.
$perm(строка)
The permission to determine if the posts are 'readable' by the current user.

Список изменений

С версии 3.7.0 Введена.

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

wp_count_posts()
wp_count_posts
wp-includes/post.php 3107
return apply_filters( 'wp_count_posts', $counts, $type, $perm );
wp-includes/post.php 3069
return apply_filters( 'wp_count_posts', $counts, $type, $perm );

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

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