Retrieves the feed link for a category.
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
$cat
int|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() .Default:
''
Source
function get_category_feed_link( $cat, $feed = '' ) {
return get_term_feed_link( $cat, 'category', $feed );
}
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |
Basic Example
Return the rss2 feed link for post in category 2
Automatic display of RSS
Display an rss link automatically when viewing a category. Insert this code on the category.php or archive.php page template.