Title: get_term_feed_link
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_term_feed_link( int|WP_Term|object $term, string $taxonomy, string $feed ): string|false

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#wp--skip-link--target)

Retrieves the feed link for a term.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#description)󠁿

Returns a link to the feed for all posts in a given term. A specific feed can be
requested or left blank to get the default feed.

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

 `$term`int|[WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)
|objectrequired

The ID or term object whose feed link will be retrieved.

`$taxonomy`stringoptional

Taxonomy of `$term_id`.

`$feed`stringoptional

Feed type. Possible values include `'rss2'`, `'atom'`.
 Default is the value of 
[get_default_feed()](https://developer.wordpress.org/reference/functions/get_default_feed/).

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#return)󠁿

 string|false Link to the feed for the term specified by `$term` and `$taxonomy`.

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

    ```php
    function get_term_feed_link( $term, $taxonomy = '', $feed = '' ) {
    	if ( ! is_object( $term ) ) {
    		$term = (int) $term;
    	}

    	$term = get_term( $term, $taxonomy );

    	if ( empty( $term ) || is_wp_error( $term ) ) {
    		return false;
    	}

    	$taxonomy = $term->taxonomy;

    	if ( empty( $feed ) ) {
    		$feed = get_default_feed();
    	}

    	$permalink_structure = get_option( 'permalink_structure' );

    	if ( ! $permalink_structure ) {
    		if ( 'category' === $taxonomy ) {
    			$link = home_url( "?feed=$feed&amp;cat=$term->term_id" );
    		} elseif ( 'post_tag' === $taxonomy ) {
    			$link = home_url( "?feed=$feed&amp;tag=$term->slug" );
    		} else {
    			$t    = get_taxonomy( $taxonomy );
    			$link = home_url( "?feed=$feed&amp;$t->query_var=$term->slug" );
    		}
    	} else {
    		$link = get_term_link( $term, $term->taxonomy );
    		if ( get_default_feed() === $feed ) {
    			$feed_link = 'feed';
    		} else {
    			$feed_link = "feed/$feed";
    		}

    		$link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' );
    	}

    	if ( 'category' === $taxonomy ) {
    		/**
    		 * Filters the category feed link.
    		 *
    		 * @since 1.5.1
    		 *
    		 * @param string $link The category feed link.
    		 * @param string $feed Feed type. Possible values include 'rss2', 'atom'.
    		 */
    		$link = apply_filters( 'category_feed_link', $link, $feed );
    	} elseif ( 'post_tag' === $taxonomy ) {
    		/**
    		 * Filters the post tag feed link.
    		 *
    		 * @since 2.3.0
    		 *
    		 * @param string $link The tag feed link.
    		 * @param string $feed Feed type. Possible values include 'rss2', 'atom'.
    		 */
    		$link = apply_filters( 'tag_feed_link', $link, $feed );
    	} else {
    		/**
    		 * Filters the feed link for a taxonomy other than 'category' or 'post_tag'.
    		 *
    		 * @since 3.0.0
    		 *
    		 * @param string $link     The taxonomy feed link.
    		 * @param string $feed     Feed type. Possible values include 'rss2', 'atom'.
    		 * @param string $taxonomy The taxonomy name.
    		 */
    		$link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy );
    	}

    	return $link;
    }
    ```

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

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

 [apply_filters( ‘category_feed_link’, string $link, string $feed )](https://developer.wordpress.org/reference/hooks/category_feed_link/)

Filters the category feed link.

 [apply_filters( ‘tag_feed_link’, string $link, string $feed )](https://developer.wordpress.org/reference/hooks/tag_feed_link/)

Filters the post tag feed link.

 [apply_filters( ‘taxonomy_feed_link’, string $link, string $feed, string $taxonomy )](https://developer.wordpress.org/reference/hooks/taxonomy_feed_link/)

Filters the feed link for a taxonomy other than ‘category’ or ‘post_tag’.

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

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

Generates a permalink for a taxonomy term archive.

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

Retrieves a trailing-slashed string if the site is set for adding trailing slashes.

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

Retrieves the default feed.

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

Appends a trailing slash.

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

Gets all term data from database by term ID.

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

Retrieves the taxonomy object of $taxonomy.

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

Retrieves the URL for the current site where the front end is accessible.

  | 
| [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_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

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

Checks whether the given variable is a WordPress Error.

  |

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

| Used by | Description | 
| [Walker_Category::start_el()](https://developer.wordpress.org/reference/classes/walker_category/start_el/)`wp-includes/class-walker-category.php` |

Starts the element output.

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

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

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

  |

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

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

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_term_feed_link/?output_format=md#comment-content-3047)
 2.   [loka_web](https://profiles.wordpress.org/loka9shafeek/)  [  7 years ago  ](https://developer.wordpress.org/reference/functions/get_term_feed_link/#comment-3047)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term_feed_link%2F%23comment-3047)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term_feed_link%2F%23comment-3047)
 4. Use that code to get feed link of tag
 5.     ```php
        echo  get_term_feed_link( $tag_id , 'post_tag', 'rss2' ); 
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term_feed_link%2F%3Freplytocom%3D3047%23feedback-editor-3047)

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