get_the_author_posts()
Retrieves the number of posts by the author of the current post.
No Hooks.
Returns
Int. The number of posts by the author.
Usage
get_the_author_posts();
Changelog
| Since 1.5.0 | Introduced. |
get_the_author_posts() get the author posts code WP 7.0
function get_the_author_posts() {
$post = get_post();
if ( ! $post ) {
return 0;
}
return (int) count_user_posts( $post->post_author, $post->post_type );
}