get_the_author_posts

Retrieve the number of posts by the author of the current post.

Description

(int) get_the_author_posts(); 

Returns (int)

The number of posts by the author.


Usage

  1. if ( !function_exists( 'get_the_author_posts' ) ) { 
  2. require_once ABSPATH . WPINC . '/author-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_the_author_posts(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/author-template.php  
  1. function get_the_author_posts() { 
  2. $post = get_post(); 
  3. if ( ! $post ) { 
  4. return 0; 
  5. return count_user_posts( $post->post_author, $post->post_type );