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
Hi @3dwan,
To make it work, please follow the steps below:
1. Create a custom comment form.
2. Find the "Display comment form for post IDs" option.
3. Fill the certain IDs for the posts/pages with, on where you want to display comment form, and does not fill the IDs for the posts/pages on the pages where you do not want to show the comment form.
Save delete all caches and check.
More info here: https://wpdiscuz.com/docs/wpdiscuz-documentation/getting-started/custom-comment-form/comment-form-settings/#comment_form_for_post_id
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?
I have found this snippet in WP support forums https://wordpress.org/support/topic/1076-5000-deactivate-wpdiscuz-for-registered-members-or-for-selected-posts/
add_filter('is_load_wpdiscuz', function ($isLoad, $post) {
if ($post->ID == X) {
return false;
}
return $isLoad;
}, 10,2);
I am not a developer, but since it is activated through is_load_wpdiscuz, maybe there is a way to change post ID to post category ID so WpDiscuz is excluded from all posts inside categories IDs
Thank you, and if it was meant for multiple categories, separate by commas?
Yes, this is correct.