get_author_feed_link() – Retrieves the feed link for a given author.

You appear to be a bot. Output may be restricted

Description

Retrieves the feed link for a given author.

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.

Usage

$string = get_author_feed_link( $author_id, $feed );

Parameters

$author_id
( int ) required – Author ID.
$feed
( string ) optional – Optional. Feed type. Possible values include 'rss2', 'atom'. Default is the value of get_default_feed().

Returns

string Link to the feed for the author specified by $author_id.

Source

File name: wordpress/wp-includes/link-template.php
Lines:

1 to 33 of 33
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;
}
 

 View on GitHub View on Trac