Purge followers from one post  

  RSS

eduardorms
(@eduardorms)
Member Customer
Joined: 2 years ago
Posts: 2
17/05/2019 6:03 pm  

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
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 2891
20/05/2019 2:38 pm  

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
(@eduardorms)
Member Customer
Joined: 2 years ago
Posts: 2
20/05/2019 9:25 pm  

Thanks. Is there any example code of wpdiscuz_email_notification use?

 


ReplyQuote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 2891
22/05/2019 12:54 pm  

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: