get_author_feed_link( int $author_id, string $feed = '' ): string
- Since
- 2.5.0
- Source
wp-includes/link-template.php:870
Retrieves the feed link for a given author.
Description
Returns a link to the feed for all posts by a given author. A specific feed can be requested or left blank to get the default feed.
Parameters
$author_idint- Author ID.
$feedstringoptional- Feed type. Possible values include 'rss2', 'atom'. Default is the value of get_default_feed().Default:
''
Return
string- Link to the feed for the author specified by $author_id.
Hooks fired · 1
One hook fires while get_author_feed_link() runs, in this order:
- apply_filters( author_feed_link )filterline 899 (+29 into the body)
Filters the feed link for a given author.
Uses · 7
- get_option()Retrieves an option value based on an option name.
- get_default_feed()Retrieves the default feed.
- home_url()Retrieves the URL for the current site where the front end is accessible.
- get_author_posts_url()Retrieves the URL to the author page for the user with the ID provided.
- trailingslashit()Appends a trailing slash.
- user_trailingslashit()Retrieves a trailing-slashed string if the site is set for adding trailing slashes.
- apply_filters()Calls the callback functions that have been added to a filter hook.
Used by · 4
- feed_links_extra()Displays the links to the extra feeds such as category feeds.
- get_author_rss_link()Print/Return link to author RSS feed.
- wp_list_authors()Lists all the authors of the site, with several options available.
- wp_list_users()Lists all the users of the site, with several options available.
Source
function get_author_feed_link( $author_id, $feed = '' ) { $author_id = (int) $author_id; $permalink_structure = get_option( 'permalink_structure' ); if ( empty( $feed ) ) { $feed = get_default_feed(); } if ( ! $permalink_structure ) { $link = home_url( "?feed=$feed&author=" . $author_id ); } else { $link = get_author_posts_url( $author_id ); if ( get_default_feed() === $feed ) { $feed_link = 'feed'; } else { $feed_link = "feed/$feed"; } $link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' ); } /** * Filters the feed link for a given author. * * @since 1.5.1 * * @param string $link The author feed link. * @param string $feed Feed type. Possible values include 'rss2', 'atom'. */ $link = apply_filters( 'author_feed_link', $link, $feed ); return $link;}History
Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/link-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.