The effects of alcohol on
sustanon 250 leucine for – real weight loss & bodybuilding benefits?
[Solved] Comment form for specific category
How-to and Troubleshooting
(@3dwan)
Eminent Member
Joined: 6 years ago
Hello,
I was wondering how can I restrict wpdiscuz comments for certain post categories ID's, I have already made available for post type = posts & attachments but how can I make it restricted for specific post category, this is very important, I hope there is a snippet or something that would help.
Thank you
(@3dwan)
Eminent Member
Joined: 6 years ago
My website is for users to publish posts themselves, I need wpdiscuz for these posts, but for other categories, I need the regular WP comment form. That is why, the only way to do so is by categories ID not post ID. Isn't there a snippet to restrict WpDiscuz from a few post categories?
(@alina)
Joined: 6 years ago
Member
Posts: 71
May 30, 2020 11:20 am
@3dwan,
Please use the following code:
add_filter("is_load_wpdiscuz", function ($load, $post) {
if (has_category([22], $post)) {
$load = false;
}
return $load;
}, 10, 2);
Please note the red marked value the category ID.
The code should be added in your active WordPress theme functions.php file.
(@3dwan)
Joined: 6 years ago
Eminent Member
Posts: 17
May 30, 2020 11:22 am
@alina
Great news! Thank you, and if it was meant for multiple categories, separate by commas?
(@alina)
Member
Joined: 6 years ago
Thank you, and if it was meant for multiple categories, separate by commas?
Yes, this is correct.