Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Allow Users to Subscribe to Categories in WordPress

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Are you looking for a way to allow users to subscribe to specific categories in WordPress?

When you offer a separate RSS feed for each category, visitors can subscribe to the topics they are most interested in. This can get you more subscribers and more engagement.

In this article, we will show you how to allow users to subscribe to categories in WordPress.

How to Allow Users to Subscribe to Categories in WordPress

Why Allow Users to Subscribe to Categories in WordPress?

Categories allow you to group your blog posts into different topics and sections. This can help visitors find interesting and relevant content, which can increase your pageviews and reduce the bounce rate while also improving the visitor experience.

For example, if you have a travel blog, then you might create categories such as Accommodation, Itineraries, and Safety Tips.

WordPress automatically creates an RSS feed for each category on your blog. In this way, visitors can subscribe to your content and get a notification every time you publish a new blog post they may be interested in.

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

That said, let’s see how you can allow users to subscribe to individual categories on your WordPress website.

How to Allow Users to Subscribe to Categories in WordPress

One solution is to add a ‘Subscribe’ link to your site’s category pages. These are the pages that show all the posts within a specific category.

For example, www.example.com/category/wordpress would list all the posts in the ‘WordPress’ category.

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

Once the plugin is activated, go to Code Snippets » Add Snippet.

Adding a custom code snippet to WordPress

Here, you will see all the ready-made WPCode snippets you can add to your site. These include a snippet that allows you to completely disable comments, upload file types that WordPress doesn’t usually support, disable attachment pages, and much more.

On the next screen, just hover your mouse over the ‘Add Your Custom Code (New Snippet)’ option and click the ‘Use snippet’ button when it appears.

Adding a custom code snippet to WordPress

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

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

Subscribing to WordPress categories

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

<?php
$category = get_category( get_query_var('cat') );
   
if ( ! empty( $category ) )
   
echo '<div class="category-feed"><p><a href="' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe to this category" 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’.

Adding code to the WordPress site wide header

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

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

Adding code to your website using smart conditional logic

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

After that, open the next set of dropdown menus and select ‘Taxonomy Page’, ‘Is’, and ‘Category’. This will add the code to your category pages only.

Allowing users to subscribe to categories in WordPress

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.

Adding an RSS subscribe button to WordPress using WPCode

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

This is what it looked like on our demo website.

Allow users to subscribe to categories in WordPress

How to Add an RSS Icon to the WordPress Category Pages

Another option is to add an RSS icon to the category pages. This may grab the visitor’s attention more than a plain link.

To add an RSS icon to your WordPress category pages, you will need to start by uploading the icon you want to use. You can use any icon you want, but you can 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 will be using it in the next step.

Getting the URL for an image in the WordPress media library

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
$category = get_category( get_query_var('cat') );
   
if ( ! empty( $category ) )
   
echo '<div class="category-feed"><a href="' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe to this category" 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 to the RSS icon you uploaded in the previous step.

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

Now, if you visit any category page, you will see the RSS icon live.

Adding an RSS icon to a WordPress website

Adding Other Subscription Options for Categories in WordPress

Most people who use an RSS reader will already have installed the service’s browser extension so that they can easily add new feeds. However, you can often encourage them to subscribe by adding the icons for these different services.

As an example, we will show you how to add buttons for Feedly and Inoreader, but you can use the same steps to add any other services you like.

Adding subscription options to a WordPress category page

To start, you will need to add the icons for the services you want to show. You can often find suitable icons on the service’s website or by doing a quick Google search.

For each RSS icon, you will need to make a note of its URL inside the WordPress media library.

With that done, simply create a new PHP snippet by following the same process described above with WPCode. However, this time, you will need to add the following code:

<?php
$category = get_category( get_query_var('cat') );
   
if ( ! empty( $category ) )
   
echo '<div class="category-feed"><p>Subcribe via: <a href="' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe to this category" rel="nofollow"><img src="http://localhost:10003/wp-content/uploads/2023/07/rss-icon.png" width="32" height="32" alt="Subscribe" /></a>
   
   
<a href="http://www.feedly.com/i/subscription/feed/' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe via Feedly" rel="nofollow"><img src="http://localhost:10003/wp-content/uploads/2023/07/feedly.png" width="32" height="32" alt="Subscribe" /></a>
   
   
<a href="https://www.inoreader.com/?add_feed=' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe via Inoreader" rel="nofollow"><img src="http://localhost:10003/wp-content/uploads/2023/07/inoreader.png" width="32" height="32" alt="Subscribe" /></a>
   
</p></div>';
?>

As before, you will need to replace each link with the image URL that you want to show on your WordPress website.

Adding Email Subscription for Categories in WordPress

Many users are not familiar with RSS, so it’s a good idea to offer email subscriptions, too.

To add email subscription for categories, you will need to use an email marketing service. We recommend Constant Contact or Brevo (formerly Sendinblue) as they offer an RSS to Email feature.

After choosing an email marketing service, you will need to create an email list and set up an email campaign.

To collect subscribers, we recommend using OptinMonster. It is the best lead-generation software that helps you convert visitors into subscribers and customers.

You can use OptinMonster to create opt-in forms with category checkboxes without writing a single line of code.

Newsletter subscription form with category checkboxes

After that, you can follow our step-by-step guide on how to notify subscribers of new posts.

We hope this tutorial helped you learn how to allow users to subscribe to categories in WordPress. You may also want to learn how to create an email newsletter or see our expert picks for the best web push notification software.

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.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

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

23 CommentsLeave a Reply

  1. Syed Balkhi says

    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. Sina says

    Hi, What about if we want to have our subscribe feature by sending push notification in user browser?
    Is it any plugin to do this, like MailChimp for e-mail?

  3. Devesh Pal says

    First of all, huge fan of your site, very informative, thanks for your service again!

    Situation with me is my website has lets say 5 categories in total and the requirement is to display them all, now user can subscribe to any of 5 categories that he/she wish to.

    What I have done so far, I have created a subscribe option for all my blogs using feeds but not specific to categories. Can you please help me in the same! Please do reply!

    Many thanks for your support so far and in advance!

    • WPBeginner Support says

      Hi Davesh,

      Each category on your blog has its own RSS feed too. You can use that RSS feed and create a subscribe option just like you did for your main blog feeds. Please check out the article above for more details.

      Admin

      • Devesh says

        Okay!
        So can I merge all category’s feed and display only one subscribe input which can show options for selecting either one or more/all categories?

        • WPBeginner Support says

          Hi Devesh,

          Yes. Many email services allow you to create multiple RSS to Email campaigns. You can create one for each of your category and then create a form that allows users to choose which lists they want to subscribe to.

  4. roman says

    Is there a way for user to manage his subscriptions? Smth like a page or widget with all checkboxes where he could unsubscribe or subscribe to other category?

  5. Ahmed says

    Is there a way I can make something like reddit where you subscribe to categories and view them all in a separate page?

  6. Karen says

    Hi, I’m building a site for a non profit group and they want a “back office” page/area just for committee/coordinators, so they are given a login in and password to access documents, photos forms etc – not a subscriber type of function. Can you help? cheers karen

  7. Swapnali says

    Hieee,

    This tutorial is awesome… Thanks.. :)
    Was finding very difficult to get category subscription for users. Find your tutorial and work was done in just few minutes. Thanks once again.

    I want to ask one thing I am using free mailchimp, does it will cretae any problem?

  8. Marc A. Flego says

    First off, I absolutely love this website! Second, I have a question… What if you want to display these very same category subscribe links on your main blog page or even on a single blog post?

    I assumed that it would consist of the same code being integrated into blog.php and single.php but that’s not the case – the links appear, but they do not direct correctly when clicked.

    Anyone else tried this?

      • Marc A. Flego says

        Hmm, so there’s no variable category feed URL which can be linked to different blog posts? I would have thought that to be a fairly basic function in WordPress. If a blog post can display a category tag beside it, why can it not display a link to that feed on the same page? Maybe I’m missing something…

  9. Badar ul islam says

    This tutorial is super duper useful for people having alot of categories in their blog or website especially having more then 1 niche in their website.

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.