WordPress Hooks Explorer

Listing all hooks extracted WordPress Core

Details about wp_count_posts

Back to home


Filename Hook Type Line Number PHP Doc
wp-includes/post.php apply_filters 3032 /**
* Counts number of posts of a post type and if user has permissions to view.
* This function provides an efficient method of finding the amount of post's
* type a blog has. Another method is to count the amount of items in
* get_posts(), but that method has a lot of overhead with doing so. Therefore,
* when developing for 2.5+, use this function instead.
* The $perm parameter checks for 'readable' value and if the user can read
* private posts, it will display that for the user that is signed in.
* @since 2.5.0
* @global wpdb $wpdb WordPress database abstraction object.
* @param string $type Optional. Post type to retrieve count. Default 'post'.
* @param string $perm Optional. 'readable' or empty. Default empty.
* @return stdClass Number of posts for each status.
wp-includes/post.php apply_filters 3070 /**
* Modifies returned post counts by status for the current post type.
* @since 3.7.0
* @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.

Hook Parameters

Parameter Type Name Description