get_the_author_posts_link

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

Description

(string) get_the_author_posts_link(); 

Returns an HTML-formatted link using get_author_posts_url().

Returns (string)

An HTML link to the author page.


Usage

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

Defined (1)

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

/wp-includes/author-template.php  
  1. function get_the_author_posts_link() { 
  2. global $authordata; 
  3. if ( ! is_object( $authordata ) ) { 
  4. return; 
  5.  
  6. $link = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',  
  7. esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),  
  8. /** translators: %s: author's display name */ 
  9. esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),  
  10. ); 
  11.  
  12. /** 
  13. * Filters the link to the author page of the author of the current post. 
  14. * @since 2.9.0 
  15. * @param string $link HTML link. 
  16. */