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

---

# feed_links_extra( array $args = array() )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/feed_links_extra/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/feed_links_extra/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/feed_links_extra/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/feed_links_extra/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/feed_links_extra/?output_format=md#changelog)

Displays the links to the extra feeds such as category feeds.

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

 `$args`arrayoptional

Optional arguments.

Default:`array()`

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

    ```php
    function feed_links_extra( $args = array() ) {
    	$defaults = array(
    		/* translators: Separator between site name and feed type in feed links. */
    		'separator'     => _x( '&raquo;', '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 &#8220;%3$s&#8221; 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 );

    	/**
    	 * Filters the extra feed links arguments.
    	 *
    	 * @since 6.7.0
    	 *
    	 * @param array $args An array of extra feed links arguments.
    	 */
    	$args = apply_filters( 'feed_links_extra_args', $args );

    	/*
    	 * The template conditionals are referring to the global query, so the queried object is used rather than
    	 * depending on a global $post being set.
    	 */
    	$queried_object = get_queried_object();
    	if ( is_singular() && $queried_object instanceof WP_Post ) {
    		$post = $queried_object;

    		/** 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 '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 '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( $post ) || pings_open( $post ) || (int) $post->comment_count > 0 ) ) {
    			$title = sprintf(
    				$args['singletitle'],
    				get_bloginfo( 'name' ),
    				$args['separator'],
    				the_title_attribute(
    					array(
    						'echo' => false,
    						'post' => $post,
    					)
    				)
    			);

    			$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 )
    		);
    	}
    }
    ```

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

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

 [apply_filters( ‘feed_links_extra_args’, array $args )](https://developer.wordpress.org/reference/hooks/feed_links_extra_args/)

Filters the extra feed links arguments.

 [apply_filters( ‘feed_links_extra_show_author_feed’, bool $show )](https://developer.wordpress.org/reference/hooks/feed_links_extra_show_author_feed/)

Filters whether to display the author feed link.

 [apply_filters( ‘feed_links_extra_show_category_feed’, bool $show )](https://developer.wordpress.org/reference/hooks/feed_links_extra_show_category_feed/)

Filters whether to display the category feed link.

 [apply_filters( ‘feed_links_extra_show_post_comments_feed’, bool $show_comments_feed )](https://developer.wordpress.org/reference/hooks/feed_links_extra_show_post_comments_feed/)

Filters whether to display the post comments feed link.

 [apply_filters( ‘feed_links_extra_show_post_type_archive_feed’, bool $show )](https://developer.wordpress.org/reference/hooks/feed_links_extra_show_post_type_archive_feed/)

Filters whether to display the post type archive feed link.

 [apply_filters( ‘feed_links_extra_show_search_feed’, bool $show )](https://developer.wordpress.org/reference/hooks/feed_links_extra_show_search_feed/)

Filters whether to display the search results feed link.

 [apply_filters( ‘feed_links_extra_show_tag_feed’, bool $show )](https://developer.wordpress.org/reference/hooks/feed_links_extra_show_tag_feed/)

Filters whether to display the tag feed link.

 [apply_filters( ‘feed_links_extra_show_tax_feed’, bool $show )](https://developer.wordpress.org/reference/hooks/feed_links_extra_show_tax_feed/)

Filters whether to display the custom taxonomy feed link.

 [apply_filters( ‘feed_links_show_comments_feed’, bool $show )](https://developer.wordpress.org/reference/hooks/feed_links_show_comments_feed/)

Filters whether to display the comments feed link.

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

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

Retrieves the contents of the search WordPress query variable.

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

Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types).

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

Determines whether the query is for a search.

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

Determines whether the query is for an existing category archive page.

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

Determines whether the query is for an existing tag archive page.

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

Determines whether the query is for an existing custom taxonomy archive page.

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

Determines whether the query is for an existing author archive page.

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

Retrieves the currently queried object.

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

Determines whether the query is for an existing post type archive page.

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

Retrieves the value of a query variable in the [WP_Query](https://developer.wordpress.org/reference/classes/wp_query/) class.

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

Retrieves the permalink for a post type archive feed.

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

Retrieves the permalink for a tag feed.

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

Retrieves the feed link for a term.

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

Retrieves the permalink for the search results feed.

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

Retrieves the permalink for the post comments feed.

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

Retrieves the feed link for a category.

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

Retrieves the feed link for a given author.

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

Returns the content type for specified feed type.

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

Sanitizes the current title when retrieving or displaying.

  | 
| [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.

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

Determines whether the current post is open for comments.

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

Determines whether the current post is open for pings.

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

Retrieves translated string with gettext context.

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

Retrieves the translation of $text.

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

Escaping for HTML attributes.

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

Checks and cleans a URL.

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

Retrieves information about the current site.

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

Merges user defined arguments into defaults array.

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

Retrieves the taxonomy object of $taxonomy.

  | 
| [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.

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

Retrieves a post type object by name.

  |

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

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

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

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