Title: get_the_author_link
Published: April 25, 2014
Last modified: August 20, 2026

---

# get_the_author_link( bool $use_title_attr = true ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#wp--skip-link--target)

Retrieves either author’s link or author’s name.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#description)󠁿

If the author has a home page set, return an HTML link, otherwise just return the
author’s name.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#parameters)󠁿

 `$use_title_attr`booloptional

Whether to add a title attribute.

Default:`true`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#return)󠁿

 string An HTML link if the author’s URL exists in user meta, otherwise the result
of [get_the_author()](https://developer.wordpress.org/reference/functions/get_the_author/).

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#source)󠁿

    ```php
    function get_the_author_link( $use_title_attr = true ) {
    	if ( get_the_author_meta( 'url' ) ) {
    		global $authordata;

    		$author_url          = get_the_author_meta( 'url' );
    		$author_display_name = get_the_author();

    		/* translators: %s: Author's display name. */
    		$author_title = sprintf( __( 'Visit %s&#8217;s website' ), $author_display_name );

    		$link = sprintf(
    			'<a href="%1$s"%2$s rel="author external">%3$s</a>',
    			esc_url( $author_url ),
    			$use_title_attr ? ' title="' . esc_attr( $author_title ) . '"' : '',
    			$author_display_name
    		);

    		/**
    		 * Filters the author URL link HTML.
    		 *
    		 * @since 6.0.0
    		 *
    		 * @param string  $link       The default rendered author HTML link.
    		 * @param string  $author_url Author's URL.
    		 * @param WP_User $authordata Author user data.
    		 */
    		return apply_filters( 'the_author_link', $link, $author_url, $authordata );
    	} else {
    		return get_the_author();
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/author-template.php#L241)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/author-template.php#L241-L271)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#hooks)󠁿

 [apply_filters( ‘the_author_link’, string $link, string $author_url, WP_User $authordata )](https://developer.wordpress.org/reference/hooks/the_author_link/)

Filters the author URL link HTML.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#related)󠁿

| Uses | Description | 
| [get_the_author_meta()](https://developer.wordpress.org/reference/functions/get_the_author_meta/)`wp-includes/author-template.php` |

Retrieves the requested data of the author of the current post.

  | 
| [get_the_author()](https://developer.wordpress.org/reference/functions/get_the_author/)`wp-includes/author-template.php` |

Retrieves the author of the current post.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` |

Escaping for HTML attributes.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 4 more](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#)

| Used by | Description | 
| [the_author_link()](https://developer.wordpress.org/reference/functions/the_author_link/)`wp-includes/author-template.php` |

Displays either author’s link or author’s name.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Added `$use_title_attr` parameter. | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_the_author_link/?output_format=md#comment-content-600)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/get_the_author_link/#comment-600)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_the_author_link%2F%23comment-600)
    Vote results for this note: -1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_the_author_link%2F%23comment-600)
 4. This example displays the author’s Website URL as a link and the text for the link
    is the author’s Profile Display Name. In this example, the author’s Display Name
    is James Smith.
 5.     ```php
        <p>Written by: 
        <?php echo get_the_author_link(); ?></p>
        ```
    
 6. Which displays as:
 7. Written by: [James Smith](http://example.com)
 8.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_the_author_link%2F%3Freplytocom%3D600%23feedback-editor-600)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_the_author_link%2F)
before being able to contribute a note or feedback.