Title: comment moderate
Last modified: December 5, 2021

---

# comment moderate

 *  Resolved [Behi](https://wordpress.org/support/users/behzadr89/)
 * (@behzadr89)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/comment-moderate/)
 * Hi there.
    I need code for dont allow users for write comment to products who
   has a comment. i wanna allow them for write comment for only products that has
   not comment. in other words users cant leave comments for products that has comment.
   Thanks.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcomment-moderate%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [gVectors Support](https://wordpress.org/support/users/gvectorssupport/)
 * (@gvectorssupport)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/comment-moderate/#post-15135451)
 * [@behzadr89](https://wordpress.org/support/users/behzadr89/),
 * You can use the following hook code:
 *     ```
       add_filter("wpdiscuz_form_render", function ($output, $commentsCount, $currentUser) {
           global $post;
          if ($commentcount = get_comments_number( $post->ID )>1) {
             $output = "Your custom message";
          }
          return $output;
       }, 10, 3);
       ```
   
 * Just change the “Your custom message” part as you like.
 * Here is an instruction on how to easily add custom code in WordPress (without
   Breaking Your Site): [https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/](https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/)
 *  Thread Starter [Behi](https://wordpress.org/support/users/behzadr89/)
 * (@behzadr89)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/comment-moderate/#post-15135822)
 * Hi [@gvectorssupport](https://wordpress.org/support/users/gvectorssupport/)
    
   Thank you for kindly reply. the cod you sent work pretty good, but after adding
   the below code for showing recommended products after “Custom message” the cod
   stop working.
 * add_filter(“wpdiscuz_form_render”, function ($output, $commentsCount, $currentUser){
   
   global $post; if ($commentcount = get_comments_number( $post->ID )>1) { $output
   = “Your custom message”; } return $output; }, 10, 3); echo do_shortcode(‘[electro_vc_products_multi_category
   sortby=”mostrated” orderby=”ASC” title=” recomended products for leaving comment”
   limit=”3″]’).”;`
 *  Plugin Support [gVectors Support](https://wordpress.org/support/users/gvectorssupport/)
 * (@gvectorssupport)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/comment-moderate/#post-15136001)
 * Dear Behi,
 * For deeper customization, I may suggest you contact us via sales[at]gvectors.
   com email address and send a list of requirements you’d like to have.
 * Currently, we have plugin customization and custom addon development services
   at the gVectors Team. They can assess the custom work and create it for you. 
   Just
 *  Thread Starter [Behi](https://wordpress.org/support/users/behzadr89/)
 * (@behzadr89)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/comment-moderate/#post-15147234)
 * Dear [@gvectorssupport](https://wordpress.org/support/users/gvectorssupport/)
   yes befor i just ordered some actions.
    now you sent me this code and it works
   well. but the only thing that have to know is, when a comment wroten for a product
   and wating fo admin approving, this cod count that as a product comment. i wanna
   allow users for write comment for only products that has not comment even wating
   for approving comment. so please witch filter have to add for this cod ?
 *     ```
       add_filter("wpdiscuz_form_render", function ($output, $commentsCount, $currentUser) {
           global $post;
          if ($commentcount = get_comments_number( $post->ID )>1) {
             $output = "Your custom message";
          }
          return $output;
       }, 10, 3);
       ```
   
 *  Plugin Support [gVectors Support](https://wordpress.org/support/users/gvectorssupport/)
 * (@gvectorssupport)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/comment-moderate/#post-15150867)
 * Hi Behi,
 * Please use this one instead of the one we’ve provided in the post above:
 *     ```
       add_filter("wpdiscuz_form_render", function ($output, $commentsCount, $currentUser) {
           global $post;
           $comments = get_comments([
               "post_id" => $post->ID,
               "status" => "all"
           ]);
   
           if (count($comments) > 0) {
               $output = "Your custom message";
           }
           return $output;
       }, 10, 3);
       ```
   
 *  Thread Starter [Behi](https://wordpress.org/support/users/behzadr89/)
 * (@behzadr89)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/comment-moderate/#post-15151003)
 * It’s impressive ,My Thumb is up for you dear [@gvectorssupport](https://wordpress.org/support/users/gvectorssupport/).
   solved

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘comment moderate’ is closed to new replies.

 * ![](https://ps.w.org/wpdiscuz/assets/icon-256x256.png?rev=1076265)
 * [Comments - wpDiscuz](https://wordpress.org/plugins/wpdiscuz/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpdiscuz/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpdiscuz/)
 * [Active Topics](https://wordpress.org/support/plugin/wpdiscuz/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpdiscuz/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpdiscuz/reviews/)

## Tags

 * [moderate comments](https://wordpress.org/support/topic-tag/moderate-comments/)

 * 6 replies
 * 2 participants
 * Last reply from: [Behi](https://wordpress.org/support/users/behzadr89/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/comment-moderate/#post-15151003)
 * Status: resolved