The effects of alcohol on
sustanon 250 leucine for – real weight loss & bodybuilding benefits?
[Solved] Comment form for specific category
✦ Summarize Topic
✦
✦
✦
AI is analyzing the discussion...
How-to and Troubleshooting
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
May 28, 2020 9:01 pm
(@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
Moderator
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
May 29, 2020 2:38 pm
(@alina)
Member
Joined: 6 years ago
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
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
May 29, 2020 3:02 pm
(@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?
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
May 30, 2020 2:08 pm
(@3dwan)
Eminent Member
Joined: 6 years ago
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
(@alina)
Joined: 6 years ago
Member
Posts: 71
May 30, 2020 3:20 pm
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
@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 3:22 pm
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
@alina
Great news! Thank you, and if it was meant for multiple categories, separate by commas?
Moderator
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
May 30, 2020 3:28 pm
(@alina)
Member
Joined: 6 years ago
Thank you, and if it was meant for multiple categories, separate by commas?
Yes, this is correct.