Recently on pluginthemehub, we wrote an article about how to allow users to subscribe to categories in WordPress. We briefly mentioned that WordPress offers RSS subscription for all taxonomies: categories, tags, and custom taxonomies. In this article, we will show you how to add RSS subscription for tags and custom taxonomy archives.
Adding RSS Subscription Link on Tag Archives
First thing you need to do is go inside your themeβs folder and find the file called tag.php. If you donβt see tag.php, then look for archive.php. If you donβt see either of those, then there is a strong chance that you are using aΒ WordPress theme framework, and this article will not be as helpful for you.
Now if your theme has a tag.php file, then simply add the following code right before the loop.
If your does not have a tag.php file, but it has an archive.php file, then create a new file called tag.php and paste all the code from archive.php in it. Once you are done, then paste the above code in it.
In the code above, we first retrieved the tag ID and then used it to get tag feed link. To add image icons simply replace Subscribe text with an image tag just like we did for categories. Here is how it looked on our test website.
We can do the same thing for custom taxonomy archives.
Adding RSS Subscription Link on Custom Taxonomy Archives
WordPress allows you to add custom taxonomies to go beyond the default categories and tags (Tutorial:Β how to create custom taxonomies). The process of adding a RSS subscription link on custom taxonomy archives is very similar.
Go inside your themeβs folder and look for a file named asΒ taxonomy-{taxonomy-name}.phpΒ (for ex:Β taxonomy-topics.phpΒ if your custom taxonomy is called topics). If you donβt have a custom taxonomy template, then create a new file. Copy and paste the content of your archive.php file into this new file. Once you are done, then paste the following code above the loop:
We hope that you find this article useful in adding RSS feed links to your tags and custom taxonomy archive pages. If you have any questions or suggestions, then please let us know by leaving a comment below.