Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cliffordp/6223670 to your computer and use it in GitHub Desktop.
Save cliffordp/6223670 to your computer and use it in GitHub Desktop.
From http://www.wphub.com/tutorials/code-snippets-wordpress/ #2 Display comments in admin to authors own posts only
function wps_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;
};
if(!current_user_can('edit_others_posts')) {
add_filter('comments_clauses', 'wps_get_comment_list_by_user');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment