I am making a custom Wordpress site where School students logged in and add their posts. I am giving them rights to use wp-admin panel with little customization and modification.

QUESTION: "How can logged in user be able to see comments of his own post only in edit comment admin panel"

please suggest me some solution i am in need for the same

Thanks in advance

1 Answer 1


i had been looking for the code where logged in users will be able to see post of his own only i have managed to make simple function that we can use for the same the function snippet has to be included in functions .php file in the theme folder which you are using

function my_plugin_get_comment_list_by_user($clauses) 


if (is_admin()) 


  global $user_ID, $wpdb;

  $clauses['join'] = ", wp_posts";

  $clauses['where'] .= " AND wp_posts.post_author = ".$user_ID." AND wp_comments.comment_post_ID = wp_posts.ID";


 return $clauses;


// Ensure that editors and admins can moderate all comments



 add_filter('comments_clauses', 'my_plugin_get_comment_list_by_user');


Thanks NIkhil Joshi

  • Well done, if only you would have included a way to fix the comment count Commented Jul 3, 2021 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.