Skip to content

Instantly share code, notes, and snippets.

@mjangda
Created August 22, 2010 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjangda/544173 to your computer and use it in GitHub Desktop.
Save mjangda/544173 to your computer and use it in GitHub Desktop.
Fix to hide editorial comments from Recent Comments widget
<?php
if ( !$comments = wp_cache_get( 'widget_recent_comments', 'widget' ) ) {
$comments_count = 5;
$comments = $wpdb->get_results("SELECT $wpdb->comments.* FROM $wpdb->comments JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_status = 'publish' AND comment_type IN ('comment', '', 'trackback', 'pingback') ORDER BY comment_date_gmt DESC LIMIT $comments_count");
wp_cache_add( 'widget_recent_comments', $comments, 'widget' );
}
@mjangda
Copy link
Author

mjangda commented Aug 26, 2010

Note: Doesn't work with 3.0+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment