The JetPack plugin for WordPress includes a Subscription module which does two main things:
- It allows your website readers to subscribe to your blog through the comment form or via a subscription form widget.
- It sends email alerts of new posts automatically whenever you publish a new article. Additionally, it automatically sends alerts of follow-up comments to readers that have subscribed to a specific post’s comments.
By the way, these subscription emails are sent to your subscribers through WordPress.com servers ([email protected]) and not via your hosting. This is more efficient resource-wise and less likely to end up in the Spam folders.
Compared to other dedicated email newsletter plugins, the JetPack subscription module is entirely automated and lacks ready options to control which posts can be sent to subscribers. This is an essential feature, especially for blogs that publish content on secondary topics which are unsuitable for subscribers who are expecting a particular topic.
It may also be vital for blogs that normally publish numerous posts as it may come across as spammy should subscribers receive several new post emails within a short period.
Disable Subscriptions using a Category
Older versions of JetPack used to support disabling subscriptions per post. This option would be the most ideal for our requirements, however this option became broken with WordPress 5.0 (Gutenberg) and the issue is still open here.
The alternative I could find is to use an exclusion category. This works by excluding posts belonging to a category from being emailed to subscribers.
To set it up, add the following snippet to your theme’s functions.php
file or simply use the Code Snippets plugin:
function jetpackme_exclude_posts_subscriptions( $categories ) {
$categories = array( 'news' );
return $categories;
}
add_filter( 'jetpack_subscriptions_exclude_these_categories', 'jetpackme_exclude_posts_subscriptions' );
Change news
with the slug of the category you want to exclude from subscriptions.
You can also exclude multiple categories as follows:
function jetpackme_exclude_posts_subscriptions( $categories ) {
$categories = array( 'news', 'sponsored' );
return $categories;
}
add_filter( 'jetpack_subscriptions_exclude_these_categories', 'jetpackme_exclude_posts_subscriptions' );
The above snippet will exclude any posts assigned to the news
or sponsored
categories.
Hi there,
If I want to disable all of my categories and posts form Jetpack sending email notifications, is there any code to do that?
Hello Oliver,
You can disable all post notifications by deactivating the Subscription module by going to the JetPack Dashboard >scroll to the footer of the page > Modules.
Hello Kelvin,
Which modules should I deactivate?
The Subscription module
Many thanks for your help. I miss the module name in your first comment.
No problem, glad to be of help.
Just to check, I assume this is added as a PHP snippet. And also that it is set to “everywhere”
Yes, it’s added as a PHP snippet in your theme’s function.php file. What do you mean by everywhere?