get_the_author_posts_link

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

WordPress Version: 6.3

/**
 * Retrieves an HTML link to the author page of the current post's author.
 *
 * Returns an HTML-formatted link using get_author_posts_url().
 *
 * @since 4.4.0
 *
 * @global WP_User $authordata The current author's data.
 *
 * @return string An HTML link to the author page, or an empty string if $authordata is not set.
 */
function get_the_author_posts_link()
{
    global $authordata;
    if (!is_object($authordata)) {
        return '';
    }
    $link = sprintf(
        '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
        esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)),
        /* translators: %s: Author's display name. */
        esc_attr(sprintf(__('Posts by %s'), get_the_author())),
        get_the_author()
    );
    /**
     * Filters the link to the author page of the author of the current post.
     *
     * @since 2.9.0
     *
     * @param string $link HTML link.
     */
    return apply_filters('the_author_posts_link', $link);
}

WordPress Version: 5.5

/**
 * Retrieves an HTML link to the author page of the current post's author.
 *
 * Returns an HTML-formatted link using get_author_posts_url().
 *
 * @since 4.4.0
 *
 * @global WP_User $authordata The current author's data.
 *
 * @return string An HTML link to the author page, or an empty string if $authordata isn't defined.
 */
function get_the_author_posts_link()
{
    global $authordata;
    if (!is_object($authordata)) {
        return '';
    }
    $link = sprintf(
        '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
        esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)),
        /* translators: %s: Author's display name. */
        esc_attr(sprintf(__('Posts by %s'), get_the_author())),
        get_the_author()
    );
    /**
     * Filters the link to the author page of the author of the current post.
     *
     * @since 2.9.0
     *
     * @param string $link HTML link.
     */
    return apply_filters('the_author_posts_link', $link);
}

WordPress Version: 5.3

/**
 * Retrieves an HTML link to the author page of the current post's author.
 *
 * Returns an HTML-formatted link using get_author_posts_url().
 *
 * @since 4.4.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @return string An HTML link to the author page, or an empty string if $authordata isn't defined.
 */
function get_the_author_posts_link()
{
    global $authordata;
    if (!is_object($authordata)) {
        return '';
    }
    $link = sprintf(
        '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
        esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)),
        /* translators: %s: Author's display name. */
        esc_attr(sprintf(__('Posts by %s'), get_the_author())),
        get_the_author()
    );
    /**
     * Filters the link to the author page of the author of the current post.
     *
     * @since 2.9.0
     *
     * @param string $link HTML link.
     */
    return apply_filters('the_author_posts_link', $link);
}

WordPress Version: 5.1

/**
 * Retrieves an HTML link to the author page of the current post's author.
 *
 * Returns an HTML-formatted link using get_author_posts_url().
 *
 * @since 4.4.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @return string An HTML link to the author page, or an empty string if $authordata isn't defined.
 */
function get_the_author_posts_link()
{
    global $authordata;
    if (!is_object($authordata)) {
        return '';
    }
    $link = sprintf(
        '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
        esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)),
        /* translators: %s: author's display name */
        esc_attr(sprintf(__('Posts by %s'), get_the_author())),
        get_the_author()
    );
    /**
     * Filters the link to the author page of the author of the current post.
     *
     * @since 2.9.0
     *
     * @param string $link HTML link.
     */
    return apply_filters('the_author_posts_link', $link);
}

WordPress Version: 4.7

/**
 * Retrieves an HTML link to the author page of the current post's author.
 *
 * Returns an HTML-formatted link using get_author_posts_url().
 *
 * @since 4.4.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @return string An HTML link to the author page.
 */
function get_the_author_posts_link()
{
    global $authordata;
    if (!is_object($authordata)) {
        return;
    }
    $link = sprintf(
        '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
        esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)),
        /* translators: %s: author's display name */
        esc_attr(sprintf(__('Posts by %s'), get_the_author())),
        get_the_author()
    );
    /**
     * Filters the link to the author page of the author of the current post.
     *
     * @since 2.9.0
     *
     * @param string $link HTML link.
     */
    return apply_filters('the_author_posts_link', $link);
}

WordPress Version: 4.6

/**
 * Retrieves an HTML link to the author page of the current post's author.
 *
 * Returns an HTML-formatted link using get_author_posts_url().
 *
 * @since 4.4.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @return string An HTML link to the author page.
 */
function get_the_author_posts_link()
{
    global $authordata;
    if (!is_object($authordata)) {
        return;
    }
    $link = sprintf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>', esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)), esc_attr(sprintf(__('Posts by %s'), get_the_author())), get_the_author());
    /**
     * Filters the link to the author page of the author of the current post.
     *
     * @since 2.9.0
     *
     * @param string $link HTML link.
     */
    return apply_filters('the_author_posts_link', $link);
}

WordPress Version: 4.4

/**
 * Retrieves an HTML link to the author page of the current post's author.
 *
 * Returns an HTML-formatted link using get_author_posts_url().
 *
 * @since 4.4.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @return string An HTML link to the author page.
 */
function get_the_author_posts_link()
{
    global $authordata;
    if (!is_object($authordata)) {
        return;
    }
    $link = sprintf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>', esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)), esc_attr(sprintf(__('Posts by %s'), get_the_author())), get_the_author());
    /**
     * Filter the link to the author page of the author of the current post.
     *
     * @since 2.9.0
     *
     * @param string $link HTML link.
     */
    return apply_filters('the_author_posts_link', $link);
}