Created
August 22, 2010 19:40
-
-
Save mjangda/544173 to your computer and use it in GitHub Desktop.
Fix to hide editorial comments from Recent Comments widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: Doesn't work with 3.0+