get_the_author_posts

The timeline below displays how wordpress function get_the_author_posts has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Retrieves 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);
}

WordPress Version: 4.2

/**
 * 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);
}

WordPress Version: 4.1

/**
 * 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);
}

WordPress Version: 4.0

/**
 * Retrieve the number of posts by the author of the current post.
 *
 * @since 1.5.0
 *
 * @uses $post The current post in the Loop's DB object.
 * @uses count_user_posts()
 * @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);
}

WordPress Version: 3.9

/**
 * Retrieve the number of posts by the author of the current post.
 *
 * @since 1.5.0
 *
 * @uses $post The current post in the Loop's DB object.
 * @uses count_user_posts()
 * @return int The number of posts by the author.
 */
function get_the_author_posts()
{
    return count_user_posts(get_post()->post_author);
}

WordPress Version: 3.7

/**
 * Retrieve the number of posts by the author of the current post.
 *
 * @since 1.5
 * @uses $post The current post in the Loop's DB object.
 * @uses count_user_posts()
 * @return int The number of posts by the author.
 */
function get_the_author_posts()
{
    return count_user_posts(get_post()->post_author);
}