Limit wp_get_recent_posts() to real/live posts, props josephscott, fixes #11123

git-svn-id: http://svn.automattic.com/wordpress/trunk@12237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-11-20 03:01:22 +00:00
parent b48cf4a3e3
commit 128927e43b
1 changed files with 3 additions and 3 deletions

View File

@ -1504,12 +1504,12 @@ function wp_get_recent_posts($num = 10) {
// Set the limit clause, if we got a limit
$num = (int) $num;
if ($num) {
if ( $num ) {
$limit = "LIMIT $num";
}
$sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";
$result = $wpdb->get_results($sql,ARRAY_A);
$sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status IN ( 'draft', 'publish', 'future', 'pending', 'private' ) ORDER BY post_date DESC $limit";
$result = $wpdb->get_results($sql, ARRAY_A);
return $result ? $result : array();
}