the_author_posts()WP 0.71

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.

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

0

#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() code WP 6.9

function the_author_posts() {
	echo get_the_author_posts();
}