Show to author his posts comments only

http://socalohv.com/images/General/Moderator.jpg

See your posts comments only

When authors of your blog click ‘Comments’ menu item in WordPress backend, they see all comments by default, not only from theirs posts. Yes, it’s not possible to do something with such comments (any actions are blocked in case are not a post author) but what the sense to see on all this mess and search comments from your posts to moderate inside full comments list? I think you agree, there is a little sense, if nothing at all.
Do you wish to show for your authors comments from theirs posts only?

This little addition to blog current theme functions.php file could save a lot of time for your blog authors:

if (!current_user_can('edit_others_posts')) {
  function author_posts_comments_only($query) {
    global $current_user;
 
    $query->query_vars['post_author'] = $current_user->ID;
  }
 
  add_action('pre_get_comments', 'author_posts_comments_only');
}

Using WordPress actions we just add post author user Id to the list of query parameters with code above. The rest part WordPress makes itself. Thanks to so universal and extensible code from WordPress developers.

Tags: , ,

  • David Naves

    Exactly what i was looking for, 
    Vladimir.  Thank you for saving me hours of work. May you live to be 1000 years old.  

    Cheers from your newest fan,
    //Dave

  • You are welcome! Thanks to you. It’s a pleasure to read so good wish. I agree. Why not to try :).

  • Pogo20

    nice one!

  • ali

    hi you’re amazing! you can solve the problem that all known plugins can not solve it …. veryyyyyyyyyy thanks

  • shivakumar k

    Thanks you very much 🙂