get_the_author_posts_link()
Retrieves an HTML link to the author page of the current post's author.
Returns an HTML-formatted link using get_author_posts_url().
Used By: the_author_posts_link()
1 time — 0.014242 sec (extremely slow) | 50000 times — 5.91 sec (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();
Examples
#1 Display a link to the author's archive page
The link text will be the author's name:
<p>Other author's posts: <?= get_the_author_posts_link() ?></p>
This displays:
<p>Other posts by the author: <a href="/author/kama" title="Kama posts" rel="author">Kama</a></p>
The the_author_posts_link() function does the same. Only it will immediately output the result without echo.
Notes
- Global. WP_User. $authordata The current author's data.
Changelog
Since 4.4.0 | Introduced. |