1. 首页
  2. WordPress 函数手册

get_the_author_posts()

get_the_author_posts()

检索当前文章作者的文章数。
Retrieve the number of posts by the author of the current post.

目录锚点:#返回#源码#笔记


返回(Return)

(int)提交人的帖子数量。


源码(Source)

/**
 * 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 );
}
更新版本 源码位置 使用 被使用
1.5.0 wp-includes/author-template.php:264 1 function 2

笔记(Notes)

基本示例

get_the_author_posts() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_the_author_posts/