the_author_posts()
Outputs the total number of posts (int) written by the current author. Used inside the WordPress Loop.
Drafts and private posts will not be counted.
Uses: get_the_author_posts()
1 time — 0.004421 sec (very slow) | 50000 times — 168.14 sec (extremely slow) | PHP 7.1.2, WP 4.7.3
No Hooks.
Returns
null.
Usage
<?php the_author_posts(); ?>
Examples
#1 Display the name of the author and his posts count:
<p><?php the_author(); ?> published <?php the_author_posts(); ?> posts</p>
Result: Jhon Smith published 425 posts
Changelog
| Since 0.71 | Introduced. |
the_author_posts() the author posts code WP 6.9
function the_author_posts() {
echo get_the_author_posts();
}