Yay! We got filters!
Wrapping the result of the $wpdb
comments query right into a filter callback (and a plugin) is the nice way of handling comments.
/* Plugin Name: »Kaisers« Comments without admin comments */
! defined( 'ABSPATH' ) AND exit;
add_filter( 'comments_array', 'wpse_61072_comments_without_admin', 20, 2 );
function wpse_61072_comments_without_admin( $comments, $post_id )
{
foreach ( (array) $comments as $index => $c )
{
// Add a limit
if ( 5 <= absint( $index + 1 ) )
return (object) $comments;
// Get the authors user data
$author = get_userdata( $c->user_id );
// Unset based on the standard/default capability
if ( user_can( $author->ID, 'manage_options' ) )
unset( $comments[ $index ] );
}
return (object) $comments;
}
This one should work (not tested).