feed_links_extra

The timeline below displays how wordpress function feed_links_extra has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Displays the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array(
        /* translators: Separator between site name and feed type in feed links. */
        'separator' => _x('»', 'feed link'),
        /* translators: 1: Site name, 2: Separator (raquo), 3: Post title. */
        'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
        /* translators: 1: Site name, 2: Separator (raquo), 3: Category name. */
        'cattitle' => __('%1$s %2$s %3$s Category Feed'),
        /* translators: 1: Site name, 2: Separator (raquo), 3: Tag name. */
        'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
        /* translators: 1: Site name, 2: Separator (raquo), 3: Term name, 4: Taxonomy singular name. */
        'taxtitle' => __('%1$s %2$s %3$s %4$s Feed'),
        /* translators: 1: Site name, 2: Separator (raquo), 3: Author name. */
        'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
        /* translators: 1: Site name, 2: Separator (raquo), 3: Search query. */
        'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'),
        /* translators: 1: Site name, 2: Separator (raquo), 3: Post type name. */
        'posttypetitle' => __('%1$s %2$s %3$s Feed'),
    );
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        /** This filter is documented in wp-includes/general-template.php */
        $show_comments_feed = apply_filters('feed_links_show_comments_feed', true);
        /**
         * Filters whether to display the post comments feed link.
         *
         * This filter allows to enable or disable the feed link for a singular post
         * in a way that is independent of {@see 'feed_links_show_comments_feed'}
         * (which controls the global comments feed). The result of that filter
         * is accepted as a parameter.
         *
         * @since 6.1.0
         *
         * @param bool $show_comments_feed Whether to display the post comments feed link. Defaults to
         *                                 the {@see 'feed_links_show_comments_feed'} filter result.
         */
        $show_post_comments_feed = apply_filters('feed_links_extra_show_post_comments_feed', $show_comments_feed);
        if ($show_post_comments_feed && (comments_open() || pings_open() || $post->comment_count > 0)) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $feed_link = get_post_comments_feed_link($post->ID);
            if ($feed_link) {
                $href = $feed_link;
            }
        }
    } elseif (is_post_type_archive()) {
        /**
         * Filters whether to display the post type archive feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the post type archive feed link. Default true.
         */
        $show_post_type_archive_feed = apply_filters('feed_links_extra_show_post_type_archive_feed', true);
        if ($show_post_type_archive_feed) {
            $post_type = get_query_var('post_type');
            if (is_array($post_type)) {
                $post_type = reset($post_type);
            }
            $post_type_obj = get_post_type_object($post_type);
            $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
            $href = get_post_type_archive_feed_link($post_type_obj->name);
        }
    } elseif (is_category()) {
        /**
         * Filters whether to display the category feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the category feed link. Default true.
         */
        $show_category_feed = apply_filters('feed_links_extra_show_category_feed', true);
        if ($show_category_feed) {
            $term = get_queried_object();
            if ($term) {
                $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
                $href = get_category_feed_link($term->term_id);
            }
        }
    } elseif (is_tag()) {
        /**
         * Filters whether to display the tag feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the tag feed link. Default true.
         */
        $show_tag_feed = apply_filters('feed_links_extra_show_tag_feed', true);
        if ($show_tag_feed) {
            $term = get_queried_object();
            if ($term) {
                $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
                $href = get_tag_feed_link($term->term_id);
            }
        }
    } elseif (is_tax()) {
        /**
         * Filters whether to display the custom taxonomy feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the custom taxonomy feed link. Default true.
         */
        $show_tax_feed = apply_filters('feed_links_extra_show_tax_feed', true);
        if ($show_tax_feed) {
            $term = get_queried_object();
            if ($term) {
                $tax = get_taxonomy($term->taxonomy);
                $title = sprintf($args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name);
                $href = get_term_feed_link($term->term_id, $term->taxonomy);
            }
        }
    } elseif (is_author()) {
        /**
         * Filters whether to display the author feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the author feed link. Default true.
         */
        $show_author_feed = apply_filters('feed_links_extra_show_author_feed', true);
        if ($show_author_feed) {
            $author_id = (int) get_query_var('author');
            $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
            $href = get_author_feed_link($author_id);
        }
    } elseif (is_search()) {
        /**
         * Filters whether to display the search results feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the search results feed link. Default true.
         */
        $show_search_feed = apply_filters('feed_links_extra_show_search_feed', true);
        if ($show_search_feed) {
            $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
            $href = get_search_feed_link();
        }
    }
    if (isset($title) && isset($href)) {
        printf('<link rel="alternate" type="%s" title="%s" href="%s" />' . "\n", feed_content_type(), esc_attr($title), esc_url($href));
    }
}

WordPress Version: 6.1

/**
 * Displays the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array(
        /* translators: Separator between blog name and feed type in feed links. */
        'separator' => _x('&raquo;', 'feed link'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Post title. */
        'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Category name. */
        'cattitle' => __('%1$s %2$s %3$s Category Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Tag name. */
        'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Term name, 4: Taxonomy singular name. */
        'taxtitle' => __('%1$s %2$s %3$s %4$s Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Author name. */
        'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Search query. */
        'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Post type name. */
        'posttypetitle' => __('%1$s %2$s %3$s Feed'),
    );
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        /** This filter is documented in wp-includes/general-template.php */
        $show_comments_feed = apply_filters('feed_links_show_comments_feed', true);
        /**
         * Filters whether to display the post comments feed link.
         *
         * This filter allows to enable or disable the feed link for a singular post
         * in a way that is independent of {@see 'feed_links_show_comments_feed'}
         * (which controls the global comments feed). The result of that filter
         * is accepted as a parameter.
         *
         * @since 6.1.0
         *
         * @param bool $show_comments_feed Whether to display the post comments feed link. Defaults to
         *                                 the {@see 'feed_links_show_comments_feed'} filter result.
         */
        $show_post_comments_feed = apply_filters('feed_links_extra_show_post_comments_feed', $show_comments_feed);
        if ($show_post_comments_feed && (comments_open() || pings_open() || $post->comment_count > 0)) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $feed_link = get_post_comments_feed_link($post->ID);
            if ($feed_link) {
                $href = $feed_link;
            }
        }
    } elseif (is_post_type_archive()) {
        /**
         * Filters whether to display the post type archive feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the post type archive feed link. Default true.
         */
        $show_post_type_archive_feed = apply_filters('feed_links_extra_show_post_type_archive_feed', true);
        if ($show_post_type_archive_feed) {
            $post_type = get_query_var('post_type');
            if (is_array($post_type)) {
                $post_type = reset($post_type);
            }
            $post_type_obj = get_post_type_object($post_type);
            $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
            $href = get_post_type_archive_feed_link($post_type_obj->name);
        }
    } elseif (is_category()) {
        /**
         * Filters whether to display the category feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the category feed link. Default true.
         */
        $show_category_feed = apply_filters('feed_links_extra_show_category_feed', true);
        if ($show_category_feed) {
            $term = get_queried_object();
            if ($term) {
                $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
                $href = get_category_feed_link($term->term_id);
            }
        }
    } elseif (is_tag()) {
        /**
         * Filters whether to display the tag feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the tag feed link. Default true.
         */
        $show_tag_feed = apply_filters('feed_links_extra_show_tag_feed', true);
        if ($show_tag_feed) {
            $term = get_queried_object();
            if ($term) {
                $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
                $href = get_tag_feed_link($term->term_id);
            }
        }
    } elseif (is_tax()) {
        /**
         * Filters whether to display the custom taxonomy feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the custom taxonomy feed link. Default true.
         */
        $show_tax_feed = apply_filters('feed_links_extra_show_tax_feed', true);
        if ($show_tax_feed) {
            $term = get_queried_object();
            if ($term) {
                $tax = get_taxonomy($term->taxonomy);
                $title = sprintf($args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name);
                $href = get_term_feed_link($term->term_id, $term->taxonomy);
            }
        }
    } elseif (is_author()) {
        /**
         * Filters whether to display the author feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the author feed link. Default true.
         */
        $show_author_feed = apply_filters('feed_links_extra_show_author_feed', true);
        if ($show_author_feed) {
            $author_id = (int) get_query_var('author');
            $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
            $href = get_author_feed_link($author_id);
        }
    } elseif (is_search()) {
        /**
         * Filters whether to display the search results feed link.
         *
         * @since 6.1.0
         *
         * @param bool $show Whether to display the search results feed link. Default true.
         */
        $show_search_feed = apply_filters('feed_links_extra_show_search_feed', true);
        if ($show_search_feed) {
            $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
            $href = get_search_feed_link();
        }
    }
    if (isset($title) && isset($href)) {
        printf('<link rel="alternate" type="%s" title="%s" href="%s" />' . "\n", feed_content_type(), esc_attr($title), esc_url($href));
    }
}

WordPress Version: 5.6

/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array(
        /* translators: Separator between blog name and feed type in feed links. */
        'separator' => _x('&raquo;', 'feed link'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Post title. */
        'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Category name. */
        'cattitle' => __('%1$s %2$s %3$s Category Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Tag name. */
        'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Term name, 4: Taxonomy singular name. */
        'taxtitle' => __('%1$s %2$s %3$s %4$s Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Author name. */
        'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Search query. */
        'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Post type name. */
        'posttypetitle' => __('%1$s %2$s %3$s Feed'),
    );
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_post_type_archive()) {
        $post_type = get_query_var('post_type');
        if (is_array($post_type)) {
            $post_type = reset($post_type);
        }
        $post_type_obj = get_post_type_object($post_type);
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
        $href = get_post_type_archive_feed_link($post_type_obj->name);
    } elseif (is_category()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_category_feed_link($term->term_id);
        }
    } elseif (is_tag()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_tag_feed_link($term->term_id);
        }
    } elseif (is_tax()) {
        $term = get_queried_object();
        if ($term) {
            $tax = get_taxonomy($term->taxonomy);
            $title = sprintf($args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name);
            $href = get_term_feed_link($term->term_id, $term->taxonomy);
        }
    } elseif (is_author()) {
        $author_id = (int) get_query_var('author');
        $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
        $href = get_author_feed_link($author_id);
    } elseif (is_search()) {
        $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
        $href = get_search_feed_link();
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
    }
}

WordPress Version: 5.4

/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array(
        /* translators: Separator between blog name and feed type in feed links. */
        'separator' => _x('&raquo;', 'feed link'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Post title. */
        'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Category name. */
        'cattitle' => __('%1$s %2$s %3$s Category Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Tag name. */
        'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Term name, 4: Taxonomy singular name. */
        'taxtitle' => __('%1$s %2$s %3$s %4$s Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Author name. */
        'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Search query. */
        'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Post type name. */
        'posttypetitle' => __('%1$s %2$s %3$s Feed'),
    );
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_post_type_archive()) {
        $post_type = get_query_var('post_type');
        if (is_array($post_type)) {
            $post_type = reset($post_type);
        }
        $post_type_obj = get_post_type_object($post_type);
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
        $href = get_post_type_archive_feed_link($post_type_obj->name);
    } elseif (is_category()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_category_feed_link($term->term_id);
        }
    } elseif (is_tag()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_tag_feed_link($term->term_id);
        }
    } elseif (is_tax()) {
        $term = get_queried_object();
        if ($term) {
            $tax = get_taxonomy($term->taxonomy);
            $title = sprintf($args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name);
            $href = get_term_feed_link($term->term_id, $term->taxonomy);
        }
    } elseif (is_author()) {
        $author_id = intval(get_query_var('author'));
        $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
        $href = get_author_feed_link($author_id);
    } elseif (is_search()) {
        $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
        $href = get_search_feed_link();
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
    }
}

WordPress Version: 5.3

/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array(
        /* translators: Separator between blog name and feed type in feed links. */
        'separator' => _x('&raquo;', 'feed link'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Post title. */
        'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Category name. */
        'cattitle' => __('%1$s %2$s %3$s Category Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Tag name. */
        'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Term name, 4: Taxonomy singular name. */
        'taxtitle' => __('%1$s %2$s %3$s %4$s Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Author name. */
        'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Search query. */
        'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'),
        /* translators: 1: Blog name, 2: Separator (raquo), 3: Post type name. */
        'posttypetitle' => __('%1$s %2$s %3$s Feed'),
    );
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_post_type_archive()) {
        $post_type = get_query_var('post_type');
        if (is_array($post_type)) {
            $post_type = reset($post_type);
        }
        $post_type_obj = get_post_type_object($post_type);
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
        $href = get_post_type_archive_feed_link($post_type_obj->name);
    } elseif (is_category()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_category_feed_link($term->term_id);
        }
    } elseif (is_tag()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_tag_feed_link($term->term_id);
        }
    } elseif (is_tax()) {
        $term = get_queried_object();
        if ($term) {
            $tax = get_taxonomy($term->taxonomy);
            $title = sprintf($args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name);
            $href = get_term_feed_link($term->term_id, $term->taxonomy);
        }
    } elseif (is_author()) {
        $author_id = intval(get_query_var('author'));
        $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
        $href = get_author_feed_link($author_id);
    } elseif (is_search()) {
        $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
        $href = get_search_feed_link();
    } elseif (is_post_type_archive()) {
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false));
        $post_type_obj = get_queried_object();
        if ($post_type_obj) {
            $href = get_post_type_archive_feed_link($post_type_obj->name);
        }
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
    }
}

WordPress Version: 4.5

/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array(
        /* translators: Separator between blog name and feed type in feed links */
        'separator' => _x('&raquo;', 'feed link'),
        /* translators: 1: blog name, 2: separator(raquo), 3: post title */
        'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: category name */
        'cattitle' => __('%1$s %2$s %3$s Category Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: tag name */
        'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: term name, 4: taxonomy singular name */
        'taxtitle' => __('%1$s %2$s %3$s %4$s Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: author name  */
        'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */
        'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: post type name */
        'posttypetitle' => __('%1$s %2$s %3$s Feed'),
    );
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_post_type_archive()) {
        $post_type = get_query_var('post_type');
        if (is_array($post_type)) {
            $post_type = reset($post_type);
        }
        $post_type_obj = get_post_type_object($post_type);
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
        $href = get_post_type_archive_feed_link($post_type_obj->name);
    } elseif (is_category()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_category_feed_link($term->term_id);
        }
    } elseif (is_tag()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_tag_feed_link($term->term_id);
        }
    } elseif (is_tax()) {
        $term = get_queried_object();
        $tax = get_taxonomy($term->taxonomy);
        $title = sprintf($args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name);
        $href = get_term_feed_link($term->term_id, $term->taxonomy);
    } elseif (is_author()) {
        $author_id = intval(get_query_var('author'));
        $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
        $href = get_author_feed_link($author_id);
    } elseif (is_search()) {
        $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
        $href = get_search_feed_link();
    } elseif (is_post_type_archive()) {
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false));
        $post_type_obj = get_queried_object();
        if ($post_type_obj) {
            $href = get_post_type_archive_feed_link($post_type_obj->name);
        }
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
    }
}

WordPress Version: 3.9

/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array(
        /* translators: Separator between blog name and feed type in feed links */
        'separator' => _x('&raquo;', 'feed link'),
        /* translators: 1: blog name, 2: separator(raquo), 3: post title */
        'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: category name */
        'cattitle' => __('%1$s %2$s %3$s Category Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: tag name */
        'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: author name  */
        'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */
        'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: post type name */
        'posttypetitle' => __('%1$s %2$s %3$s Feed'),
    );
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_post_type_archive()) {
        $post_type = get_query_var('post_type');
        if (is_array($post_type)) {
            $post_type = reset($post_type);
        }
        $post_type_obj = get_post_type_object($post_type);
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
        $href = get_post_type_archive_feed_link($post_type_obj->name);
    } elseif (is_category()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_category_feed_link($term->term_id);
        }
    } elseif (is_tag()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_tag_feed_link($term->term_id);
        }
    } elseif (is_author()) {
        $author_id = intval(get_query_var('author'));
        $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
        $href = get_author_feed_link($author_id);
    } elseif (is_search()) {
        $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
        $href = get_search_feed_link();
    } elseif (is_post_type_archive()) {
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false));
        $post_type_obj = get_queried_object();
        if ($post_type_obj) {
            $href = get_post_type_archive_feed_link($post_type_obj->name);
        }
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
    }
}

WordPress Version: 3.7

/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array(
        /* translators: Separator between blog name and feed type in feed links */
        'separator' => _x('&raquo;', 'feed link'),
        /* translators: 1: blog name, 2: separator(raquo), 3: post title */
        'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: category name */
        'cattitle' => __('%1$s %2$s %3$s Category Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: tag name */
        'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: author name  */
        'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */
        'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'),
        /* translators: 1: blog name, 2: separator(raquo), 3: post type name */
        'posttypetitle' => __('%1$s %2$s %3$s Feed'),
    );
    $args = wp_parse_args($args, $defaults);
    if (is_singular()) {
        $id = 0;
        $post = get_post($id);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html(get_the_title()));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_post_type_archive()) {
        $post_type = get_query_var('post_type');
        if (is_array($post_type)) {
            $post_type = reset($post_type);
        }
        $post_type_obj = get_post_type_object($post_type);
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
        $href = get_post_type_archive_feed_link($post_type_obj->name);
    } elseif (is_category()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_category_feed_link($term->term_id);
        }
    } elseif (is_tag()) {
        $term = get_queried_object();
        if ($term) {
            $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
            $href = get_tag_feed_link($term->term_id);
        }
    } elseif (is_author()) {
        $author_id = intval(get_query_var('author'));
        $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
        $href = get_author_feed_link($author_id);
    } elseif (is_search()) {
        $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
        $href = get_search_feed_link();
    } elseif (is_post_type_archive()) {
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false));
        $post_type_obj = get_queried_object();
        if ($post_type_obj) {
            $href = get_post_type_archive_feed_link($post_type_obj->name);
        }
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
    }
}