Notifications
Clear all

Purge followers from one post

4 Posts
2 Users
0 Likes
1,683 Views
(@eduardorms)
Member Customer
Joined: 7 years ago
Posts: 2
Topic starter  

I have a post with 5K+ comment followers and every comment generate a big mail server queue and slow down my server, 2 comments or 3 comments in sequence... doom. So, how can i purge the notifications from this specific post? Thanks.


   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5872
 

Hi @eduardorms,

I'm sorry, but there is no option for this. You should do it using wpdiscuz_email_notification hook.  I mean that disable the subscription for the current post using the hook.  


   
ReplyQuote
(@eduardorms)
Member Customer
Joined: 7 years ago
Posts: 2
Topic starter  

Thanks. Is there any example code of wpdiscuz_email_notification use?

 


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5872
 

Hi @eduardorms,

Please add the following code in your active theme's functions.php file.  Please change the red marked code before using, set it the current post ID. 

// disable notifications from the specific (X) post
add_filter('wpdiscuz_email_notification', function ($val, $emailData, $comment) {
if ($comment->comment_post_ID == X) {
$val = false;
}
return $val;
}, 1, 3);

// followers
add_filter('wpdiscuz_follow_email_notification', function ($val, $followerData, $comment) {
if ($comment->comment_post_ID == X) {
$val = false;
}
return $val;
}, 1, 3);

   
ReplyQuote
Share:
Scroll to top