WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to make things work like where author can see only them post comment in admin comment section and they can moderate as well. While admin should have all permission.

I am having one code and working fine in all terms like showing only author's post comment but it's not allowing to moderate. Can anyone help me to find solution where author can moderate own post comment.

Code I have:

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
if(!current_user_can('edit_others_posts')) {
add_filter('comments_clauses', 'my_plugin_get_comment_list_by_user');
share|improve this question
up vote 2 down vote accepted

The default author role does not have the moderate_comments capabilities so you need to add that capability to the author role, so add this to your plugin:

function add_theme_caps() {
        $role = get_role( 'author' ); // gets the author role
        $role->add_cap( 'moderate_comments' ); // would allow the author to moderate comments
add_action( 'admin_init', 'add_theme_caps');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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