WordPress函数get_the_author_posts()获取当前作者/用户发布的文章总数

描述:

获取当前作者/用户发布的文章总数

用法:

<?php echo get_the_author_posts(); ?> 

源文件:

/**
 * Retrieve the number of posts by the author of the current post.
 *
 * @since 1.5.0
 *
 * @return int The number of posts by the author.
 */
function get_the_author_posts() {
	$post = get_post();
	if ( ! $post ) {
		return 0;
	}
	return count_user_posts( $post->post_author, $post->post_type );
}