Title: get_category_feed_link
Published: April 25, 2014
Last modified: May 20, 2026

---

# get_category_feed_link( int|WP_Term|object $cat, string $feed = '' ): string

## In this article

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

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

Retrieves the feed link for a category.

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

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

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

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

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

`$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/).

Default:`''`

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

 string Link to the feed for the category specified by `$cat`.

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

    ```php
    function get_category_feed_link( $cat, $feed = '' ) {
    	return get_term_feed_link( $cat, 'category', $feed );
    }
    ```

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

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

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

  |

| Used by | Description | 
| [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_category_rss_link()](https://developer.wordpress.org/reference/functions/get_category_rss_link/)`wp-includes/deprecated.php` |

Print/Return link to category RSS2 feed.

  | 
| [wp_xmlrpc_server::mw_getCategories()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/mw_getcategories/)`wp-includes/class-wp-xmlrpc-server.php` |

Retrieves the list of categories on a given blog.

  |

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

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

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

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/get_category_feed_link/?output_format=md#comment-content-1414)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/get_category_feed_link/#comment-1414)
 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_category_feed_link%2F%23comment-1414)
     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_category_feed_link%2F%23comment-1414)
 4.  **Basic Example**
 5.  Return the rss2 feed link for post in category 2
 6.      ```php
         get_category_feed_link( '2', '' );
         ```
     
 7.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_category_feed_link%2F%3Freplytocom%3D1414%23feedback-editor-1414)
 8.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/get_category_feed_link/?output_format=md#comment-content-1415)
 9.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/get_category_feed_link/#comment-1415)
 10. [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_category_feed_link%2F%23comment-1415)
     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_category_feed_link%2F%23comment-1415)
 11. **Automatic display of RSS**
 12. Display an rss link automatically when viewing a category. Insert this code on
     the category.php or archive.php page template.
 13.     ```php
         if ( is_category() ) {
     
             $category = get_category( get_query_var('cat') );
     
             if ( ! empty( $category ) ) {
                 echo '<div class="category-feed"><a href="' . esc_url( get_category_feed_link( $category->cat_ID ) ) . '" title="' . sprintf( esc_attr__( 'Subscribe to this category', 'textdomain' ), $category->name ) . '" rel="nofollow">' . __( 'Subscribe!', 'txtdomain' ) . '</a></div>';
             }
         }
         ```
     
 14.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_category_feed_link%2F%3Freplytocom%3D1415%23feedback-editor-1415)

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