Wordpress default comment to select "private"

Dear WPMU team,

Does anyone know of a short modification that can allow users to select "private" when commenting on posts from Wordpress.
I want users to make private comments.

It does not exist in the default wordpress settings unfortunately.
But i am desperately in need of this function.

Any help would be appreciated.
Thank you so much !

  • Ash

    Hello @Sirye

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    I am not aware of any plugin that helps to make private comment. I have found a plugin though but it's very old: https://wordpress.org/plugins/semi-private-comments/

    But, you can try some code. In your theme, where the comments are printed (normally in comments.php file), you can try the following code:

    $comment_array = get_approved_comments($post->ID);
    
     $current_user = wp_get_current_user();
    
       foreach($comment_array as $comment){
          if ($comment->comment_author_email == $current_user->user_email) {
                  echo $comment->comment_content ;
          }
    
       }

    It's just an example, you may need to reorganize the code to fit your needs. The code will show the comment of logged in users. A logged in user won't be able to show other's comments.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.