WPDev.one
Core Function
View Source on Trac ↗

wp_count_posts()

wp_count_posts( mixed $type = 'post', mixed $perm = '' )

Counts number of posts of a post type and if user has permissions to view.

Parameters 0 required

Name / Type Description
$type
string

Optional. Post type to retrieve count. Default 'post'.

$perm
string

Optional. 'readable' or empty. Default empty.

Return Value

(stdClass)
stdClass An object containing the number of posts for each status, or an empty object if the post type does not exist.

Function Information

Since Version
2.5.0
Source File
wp-includes/post.php
Advertisement