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

How to Add RSS Subscription for Tags and Custom Taxonomy Archives

Do you want to add RSS subscriptions to your tag pages and custom taxonomy archives?

In this way, you can allow visitors to subscribe to the tags and custom taxonomies they are most interested in. This can keep people coming back to your site while also improving the visitor experience.

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?

Tags allow you to clearly label a blog post’s topic, which can help readers find interesting and relevant content. This will often keep readers on your website for longer, which can increase your pageviews and reduce the bounce rate.

You might even create custom taxonomies to further organize your content. For example, you can add a custom post type called ‘Books’ and then use a custom taxonomy called ‘Topics’.

With that in mind, you may want to add RSS subscriptions to your tags and custom taxonomies. In this way, you can notify visitors when you publish a new blog post they might be interested in.

For more on this topic, please see our complete guide on how to use RSS in WordPress.

With that being said, let’s see how you can add RSS subscription for tags and custom taxonomy archives.

Adding RSS Subscription Link on Tag Archives

One solution is to add a simple RSS ‘Subscribe’ link to your site’s tag archive pages. These pages show all the posts that have the same tag.

For example, would list all the posts that have the ‘WordPress’ tag.

An example of a 'Subscribe' link, on a WordPress tags page

This method requires you to add code to your WordPress website.

Often, tutorials will ask you to edit your theme files, but this can cause all kinds of common WordPress errors. In the worst-case scenario, it may even make your WordPress site completely inaccessible.

For that reason, we recommend using WPCode. It is the best code snippets plugin for WordPress that allows you to add custom CSS, PHP, HTML, and more to your website without putting your site at risk.

First, you will need to install and activate the free WPCode plugin. For more information, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, go to Code Snippets » Add Snippet.

Adding custom code snippets to WordPress

You will now see WPCode’s built-in code snippets library. This includes a snippet that allows you to completely disable comments, upload file types that WordPress doesn’t usually support, disable attachment pages, and much more.

Simply hover your mouse over the ‘Add Your Custom Code (New Snippet)’ option and then click the ‘Use snippet’ button when it appears.

Adding a custom code snippet to WordPress using WPCode

On the next screen, type in a title for the PHP snippet. This is just for your reference, so you can use anything you want.

Then, open the ‘Code Type’ dropdown and choose ‘PHP Snippet’.

Adding an RSS Subscription to WordPress tag pages

With that done, simply paste the following into the code editor:

$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>';

With that done, scroll to the ‘Insertion’ box and select ‘Auto Insert’ if it isn’t already selected.

You can then open the ‘Location’ dropdown and choose ‘Site Wide Header’.

Automatically add code to the site wide header in WordPress

This adds a ‘Subscribe’ link to every page and post across your WordPress blog.

To show the link on tag pages only, scroll to the ‘Smart Conditional Logic’ section. Here, click on the ‘Enable Logic’ slider.

WPCode's conditional logic settings

You can now open the ‘Conditions’ dropdown and select ‘Show’.

After that, click on ‘Add new group’.

Auto-inserting PHP code into the site wide header

Now, open the next set of dropdown menus and select ‘Taxonomy Page’, ‘Is’, and ‘Tag’.

This will add the code to your tag archive pages only.

WPCode's conditional smart logic settings

With that done, it’s time to make the snippet live by scrolling to the top of the screen.

You can now click on the ‘Inactive’ toggle so it changes to ‘Active’ and then click on the ‘Save Snippet’ button.

Publishing a custom code snippet in WordPress

Now, if you visit any tag page, you will see the new ‘Subscribe’ link live.

How to Add an RSS Icon to the WordPress Tag Pages

Another option is to add an RSS icon to the tag pages, which may be more attention-grabbing compared to a plain ‘Subscribe’ link.

An example of an RSS icon, on a WordPress tags page

To add an RSS icon to the WordPress tag pages, you will need to start by uploading the icon you want to use. You can use any icon you want, but you’ll find a logo in the PNG format over at the official RSS website.

Once you have a logo, simply upload the file to the WordPress media library. You will then need to get the image URL, as you’ll be using it in the next step.

Adding an RSS icon to your WordPress website

With that done, create a new PHP code snippet in WPCode by following the same process described above. However, this time paste the following snippet into the WPCode editor:

$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"><img src="" width="32" height="32" alt="Subscribe" </a></p></div>';

You’ll need to replace the URL with the link of the RSS icon you uploaded in the previous step.

Once again, set the code to run on tag pages only and then publish it, by following the same process described above.

Now, if you visit any tag page you’ll see the RSS icon live.

Adding RSS Subscription Link on Custom Taxonomy Archives

You can also add an RSS subscription to the custom taxonomy archives on your WordPress website. To do this, you will need to create a new PHP snippet following the same process described above.

However, this time add the following code to WPCode:

$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’d like to show an RSS icon rather than plain 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 expert picks for the best WordPress RSS plugins.

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. Here's our editorial process.

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

3 CommentsLeave a Reply

  1. Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

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