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.
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.
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, www.example.com/tag/wordpress would list all the posts that have the ‘WordPress’ tag.
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.
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.
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.
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’.
With that done, simply paste the following into the code editor:
<?php $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’.
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.
You can now open the ‘Conditions’ dropdown and select ‘Show’.
After that, click on ‘Add new group’.
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.
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.
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.
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.
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:
<?php $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="http://example.com/wp-content/uploads/2023/07/rss-icon.png" width="32" height="32" alt="Subscribe" </a></p></div>'; ?>
You’ll need to replace the http://example.com 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:
<?php $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.