Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Add RSS Subscription for Tags and Custom Taxonomy Archives

Would you like to allow your visitors to subscribe to individual tags or custom taxonomies?

When you offer a separate RSS feed for each taxonomy, your visitors can subscribe to the topics they are most interested in.

In this article, we will show you how to add RSS subscriptions for your tags and custom taxonomy archives.

How to Add RSS Subscription for Tags and Custom Taxonomy Archives

Why Let Users Subscribe to Tags & Custom Taxonomies?

When you start a WordPress blog, you can use use category and tag taxonomies to organize your blog posts to help your readers find the content they’re most interested in.

Some website owners create custom taxonomies to add additional structure. For example, a website with a custom post type called ‘Books’ may use a custom taxonomy called ‘Topics’ to sort it.

You might want to add RSS subscription to your tags and custom taxonomies. Then your website visitors can be notified when you publish a new blog post they might be interested in.

Each tag and custom taxonomy has its own feed URL. All you have to do is add /feed/ at the end of the URL. Here’s an example:

But most of your visitors won’t know how to find and subscribe to these feeds. Let’s take a look at how to add an RSS subscription link on tags and custom taxonomy archives.

Adding RSS Subscription Link on Tag Archives

We’ll start by adding a simple RSS subscription link to your tag archive pages.

To do this, you need to add code to your website files. If you haven’t done this before, then see our guide on how to paste code snippets from the web into WordPress.

The first thing you need to do is go inside your theme’s folder and find the file tag.php. If you don’t see that file, then look for archive.php.

Now, if your theme has a tag.php file, then simply add the following code right before the loop.

$tag_id = get_query_var('tag_id');
echo '<div class="tag-feed"><p><a href="' . get_tag_feed_link( $tag_id) . '" title="Subscribe to this tag" rel="nofollow">Subscribe</a></p></div>';

If your theme does not have a tag.php file but does have an archive.php file, then you need to create a new file called tag.php and paste all the code from archive.php into it. Once you are done, then paste the above code into it.

Note: If your theme doesn’t include tag.php or archive.php, then you’re probably using a WordPress theme framework and will have to create tag.php manually. A good starting point for learning how to create archive files is our guide on how to create custom archive pages in WordPress.

When you visit your website, you will be able to see a subscribe link on your tag archive pages. Here’s a screenshot from our demo website.

Subscribe to Tags Preview

This code simply adds a link with the anchor text ‘Subscribe’ to the template. You can add an RSS icon instead of text if you prefer. All you have to do is replace the ‘Subscribe’ text with an image URL like so:

<img src="" width="48" height="48" alt="Subscribe" />

Here’s a screenshot of a tag archive on our demo website once we modified the code.

Subscribe to Tags with Icon Preview

Adding RSS Subscription Link on Custom Taxonomy Archives

We can do the same thing for custom taxonomy archives.

You need to go inside your theme’s folder and look for a file with a name like taxonomy-YOURTAXONOMYNAME.php.

For example, if you have a custom taxonomy called ‘Topics’, then you need to look for a file called taxonomy-topics.php.

You then need to edit the file and paste the following code above the loop:

$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
echo '<div class="topic-feed"><p><a href="' . get_term_feed_link($term->term_id, topics, $feed) . '" title="Subscribe to this topic" rel="nofollow">Subscribe</a></p></div>';

If you don’t have a custom taxonomy template, then create a new file and name it as we described above. You should copy and paste the contents of your archive.php file into it, then add the code snippet above.

If you’d like to use an RSS icon instead of text, then simply replace the ‘Subscribe’ text with an image tag just as we did in the section above.

We hope this tutorial helped you learn how to add an RSS subscription for tags and custom taxonomy archives.

You may also want to learn how to improve your website’s SEO, or check out our list of 30 proven ways to make money blogging with WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

2 CommentsLeave a Reply

  1. Really useful article but I’ve been thinking recently about chaining tags and allowing users to create custom RSS feeds from these. Anyone have any ideas on whether this can be achieved and bonus imaginary internet points if you can tell me how!

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.