Retrieves the number of posts by the author of the current post.
Source
function get_the_author_posts() {
$post = get_post();
if ( ! $post ) {
return 0;
}
return count_user_posts( $post->post_author, $post->post_type );
}
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
Basic Example
Displays the author’s name and number of posts.
Output is “Harriett Smith has blogged 4,250 posts.”