Subscribe to Category


This plugin lets a user subscribe and unsubscribe to posts (including public custom posts) within a certain category or categories (email conformation is required when a subscription is added while not logged in).
Subscribers will receive an e-mail notification with a link to the actual post. E-mails to subscribers are sent once every hour (adjustable) with WP Cron.

The HTML form is prepared for Bootstrap framework.

Subscribers are saved as a custom post type with a possibillity to export and import(excel/csv). Un/Subscription needs to be confirmed by the subscriber.

The following settings and features are available for the administrator in current version:

  • Change e-mail sender from default
  • Change the title/subject for e-mails
  • Number of characters from the content included in the email notification
  • List of available Custom Post Types (Checkbox none, 1 or more labels)
  • List of available Custom Taxonomies (Checkbox none, 1 or more labels)
  • Enable operation of shortcode attribute ”hide_unsubscribe” feature
  • Set the reschedule time for the cron job
  • Option for re-send a post on update that has already been sent.
  • Choose between classic/gutenberg editor output
  • Turn CSS on/off
  • Export subscribers to a tab delimited CSV file with a possibility to filter by categories
  • Import subscribers from a tab delimited CSV file (with the same format as created by the export function) with a possibility to filter the categories
  • Run the cron job manually so it will fire immediately
  • Theres a note when next scheduled event for sending e-mails to subscribers is running.
  • Options for leave no trace – deletes post meta and subscribers created by this plugin.
  • Implementation by widget and / or by short code.


  • Settings page.
  • With Bootstrap framework.
  • Without Bootstrap framework, override and add your own css.
  • When resend post is enabled in settings there is a new option available when editing a post.
  • When resend post and Gutenberg editor settings are both enabled, Resend options are available in the Gutenberg document tab
  • Taxonomy edit possibility
  • STC Subscribers list with one custom taxonomy called "Taxonomies"


This section describes how to install the plugin and get it working.

  1. Upload subscribe-to-category to the /wp-content/plugins/ directory
  2. Activate the plugin through the ’Plugins’ menu in WordPress Admin
  3. Inspect and Save your settings with the dashboard menu item ’Settings > STC Settings’.
  4. Create a page and add shortcode [stc-subscribe] or use the STC Widget to display stc form subscription.
  5. Inspect /create / update subscribers with the dashboard menu item STC Subscribers

Shortcode Attributes

’category_in’ – Use this attribute if you only want one or several categories to be available for subscription. Value to be entered is the name of the category.
’category_id_in’ – The difference to above is to use the category ID instead of category name.

’category_not_in’ – Use this attribute if you want to exclude categories to be available for subscription. Value to be entered is the name of the category.
’category_id_not_in’ – The difference to above is to use the category ID instead of category name.

’hide_unsubscribe’ – Disables the unsubscribe feature is the shortcode attribute is enabled at the admin setting

For the above attributes you can use a comma sign to separate multiple categories, like [stc-subscribe category_in=”news, article”].

Filter and hooks

Following filters and hooks can be used for customizing the email message.

// Parameters: $value
add_filter( 'stc_message_length_sum_of_words', 'stc_message_length_sum_of_words', 10, 1 ); //set return value to a negative number to show the full content

// Parameters: $value, $post_id, $subscriber_post_id
add_filter( 'stc_message_title_html', 'my_stc_message_title_html', 10, 3 );
add_filter( 'stc_message_link_to_post_html', 'my_stc_message_link_to_post_html', 10, 3 );
add_filter( 'stc_message_unsubscribe_html', 'my_stc_message_unsubscribe_html', 10, 3 );
add_filter( 'stc_message_subscribe_html', 'my_stc_message_subscribe_html', 10, 3 );

// Parameters: $post_id, $subscriber_post_id  
add_action( 'stc_before_message', 'my_stc_before_message', 10, 2 );
add_action( 'stc_before_message_title', 'my_stc_before_message_title', 10, 2 );
add_action( 'stc_after_message_title', 'my_stc_after_message_title', 10, 2 );
add_action( 'stc_before_message_content', 'my_stc_before_message_content', 10, 2 );
add_action( 'stc_after_message_content', 'my_stc_after_message_content', 10, 2 );
add_action( 'stc_after_message', 'my_stc_after_message', 10, 2 );

// Parameters: $subscriber_post_id, $categories, bool $all_categories
add_action( 'stc_after_update_subscriber', 'my_stc_after_update_subscriber', 10, 3 );
add_action( 'stc_after_insert_subscriber', 'my_stc_after_insert_subscriber', 10, 3 );

// Parameters: $subscriber_post_id, 
add_action( 'stc_before_unsubscribe', 'my_stc_before_unsubscribe', 10, 1 ); // runs before deleting a subscriber from database
add_action( 'stc_before_subscribe', 'my_stc_before_subscribe', 10, 1 ); // runs before adding a subscriber to the database

 * Example for adding featured image to STC email
function my_stc_after_message_title( $post_id ){
    echo get_the_post_thumbnail( $post_id, 'thumbnail' );
add_action( 'stc_after_message_title', 'my_stc_after_message_title', 10, 2 );


Optionally but recommended

As WordPress Cron is depending on that you have visits on your website you should set up a cron job on your server to hit at a regular interval to make sure that WP Cron is running as expected. In current version of Subscribe to Category the WP Cron is running once every hour, that might be an option that is changeable in future versions.
Therefore a suggested interval for your server cron could be once every 5 minutes.

Vanliga frågor

Can STC handle Custom Post Types

Yes from version 2.4.1 it is possible to link STC with Custom created public Post Types. You can select the CPT’s on the STC admin settings page

Can STC handle custom Taxonomies

Yes from version 2.3.1 it is possble to link STC with Custom created Taxonomies. You can activate these within STC on the STC admin settings page.

What should the format for importing subscribers be?

STC can only handle tab delimited files because the catagories are seperated with comma’s from each other.
Excel gives (amongst others) you the possibility to export the worksheet as an tab delimited txt file.


4 september, 2020
But I would like to be able to customize the emails. Add logo, maybe custom text as well. Now the subscribers receive a boring mail with links, and some teaser text.
5 juni, 2020
This plugin does exactly what I need, it lets my users subscribe to a category and then receive an email every time a post is added to that category. Users can add themselves to multiple categories and catogories can be excluded from the opt in. Excellent
22 februari, 2020
How can do the same for custom post type.... this for normal posts... please answer
Läs alla 18 betyg

Bidragsgivare och utvecklare

”Subscribe to Category” är programvara med öppen källkod. Följande personer har bidragit till detta tillägg.

Bidragande personer

”Subscribe to Category” har översatts till 2 språk. Tack till översättarna för deras bidrag.

Översätt ”Subscribe to Category” till ditt språk.

Intresserad av programutveckling?

Läs programkoden, kika på SVN-filförvaret eller prenumerera på utvecklarloggen via RSS.



  • fixed issue on stc settings page when no custom post or no custom taxonomies where availble
  • fixed issue on subscription warning when no taxonomies where selected
  • fixed issue on first use of the block edtor checkbox


  • Added Custom Posts Functionality
  • Minor bugfixes


  • Fixed error in css file stc-tax-style.css causing css optimisation to fail


  • Revised category and taxonomy selection for the shortocde and widget
  • Several changes to make understand STC better
  • Fix bug in wp-mail sending corrupted base64 encode subject in notification
  • Other bugfixes




  • Small changes to adapt to WP 5.5
  • bugfixes


  • New admin setting to select custom taxonomies names (shortcode for taxonomy selection comes later for now use admin edit of subscription)
  • Muliple post to one subcriber are added together in one notification.
  • bugfixes


  • Introduced subscriber verification for subscriptions and updates while not logged in to WordPress
  • Introduced disabling of the unsubscribe checkbox
  • New admin setting to control the length of the content in the email notification
  • bugfixes


  • Added email conformation to intended stc subscriber. When confirmed the new stc subscriber becomes active. This is not required when the user is in admin mode.


  • minor bugfixes


  • changed subscription method for existing subscribers to enable updating the subscription
  • bug fixed with only one category causing nothing to show


  • Changed tekst for using the Gutenberg/Block editor to be more clear
  • Redirect to first page after subscription stays now on the current page
  • Bug fixed causing not to update the subscribers when using the classic WP editor


  • Added an admin feature to import a csv subscriberlist in exactly the same format as created by the export function


  • Added an admin setting to control the WP-Cron STC rescheduling ”send email time”. Default is 3600 second but the user can now set it to any value between 180 and 3600 => 2 minutes and 1 hour


  • during sanitizing process the email adress from the unsubscriber lost the ”@” sign causing failed unsubscribtion issues


  • implemented sanitizing and escaping according WPCS
  • adapted internationalization text domain to plugin standards
  • added ’numberposts’ => -1 to the args for exporting all subscribers to excel it was defaulting to a maximum of 5
  • minor bugfixes


  • adapted stc to wp 5.3 features by adding a stc resend option to the document tab


  • Email address preset for logged in users.
  • Japanese, Dutch, German and Norwegian language added.


  • Added pot file to be used for translation.
  • Bugfix – changed textdomain to string instead of constant.


  • Added some new hooks: stc_after_update_subscriber, stc_after_insert_subscriber, stc_before_unsubscribe.


  • Added a Widget for subscription form.
  • Don’t show category list if only one is available (thanks to davefx).
  • Extended short code attributes with an option to use category id instead of category name (thanks to Stingray_454).


  • Added hooks and filters to make the plugin extensible.
  • Added Lithuanian language.


  • Fixed some undefined variables that might have caused some errors for some environments.
  • Renamed language files for russian language to correct syntax.
  • Added Italian language.


  • Possibillity to re-send a post on update that has already been sent. This option needs to be activated in the settings for the plugin.
  • Attribute ’category_in’ added to shortcode to show only entered categories in the subscribe form. Multiple categories are separated by a comma sign.
  • Attribute ’category_not_in’ added to shortcode to exclude categories in the subscribe form. Multiple categories are separated by a comma sign.


  • Added php sleep() function to prevent sending all e-mails in the same scope.
  • Using Ajax when send is manually triggered in back-end.


  • First release