[Support request] Disable “Leave a comment” section until the previous comment is moderated

Home Forums Support [Support request] Disable “Leave a comment” section until the previous comment is moderated

Home Forums Support Disable “Leave a comment” section until the previous comment is moderated

  • This topic has 1 reply, 2 voices, and was last updated 4 weeks ago by David.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2285056
    Marcel

    Hello,

    Do you think there is an option to change the PHP code so that the “Leave a comment” section is disabled until the previous comment is moderated?

    Thank you!

    Marcel

    #2285374
    David
    Staff
    Customer Support

    Hi there,

    try this PHP Snippet:

    add_filter( 'comments_open', function( $open, $post_id ){
      $counts = wp_count_comments( $counts, $post_id  );
      if ( 0 !== $counts->moderated ) {
          $open = false;
      }
      return $open;
    }, 10, 2 );
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.