Show to author his posts comments only

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: , ,