WordPress at a glance

get_the_author_posts_link() WP 1.0

Retrieves an HTML link to the author page of the current post's author.

Returns an HTML-formatted link using get_author_posts_url().

Is the basis for: the_author_posts_link()
✈ 1 time = 0.014242s = extremely slow | 50000 times = 5.91s = fast | PHP 7.1.11, WP 4.9.8
Hooks from the function
Return

String. An HTML link to the author page, or an empty string if $authordata isn't defined.

Usage

get_the_author_posts_link();

Notes

  • Global. Object. $authordata The current author's DB object.

Changelog

Since 4.4.0 Introduced.

Code of get the author posts link: wp-includes/author-template.php WP 5.2.4

<?php
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 );
}

Related Functions

From tag: Archive pages

More from tag: Link (tag A in HTML)

More from category: Other

No comments
    Hello, !     Log In . Register