You could try this to skip comments made by user with user_id = 1
in the Recent Comments widget:
add_action( 'widgets_init', 'custom_recent_comments' );
function custom_recent_comments(){
add_filter( 'comments_clauses', 'custom_comments_clauses' );
}
where
function custom_comments_clauses( $clauses ){
$clauses['where'] .= " AND user_id != 1 "; // EDIT
return $clauses;
}
In a similar way you can target the user email with:
$clauses['where'] .= " AND comment_author_email != '[email protected]' "; // EDIT
This will affect the where
part of all the comments queries made after the widgets_init
hook.
PS: If you only want to run the where
-filter once after the widgets_init
hook, you can use this modification of the custom_comments_clauses()
function:
function custom_comments_clauses( $clauses ){
remove_filter( 'comments_clauses', 'custom_comments_clauses' );
$clauses['where'] .= " AND user_id != 1 "; // EDIT
return $clauses;
}