Make WordPress Core

Changeset 12237


Ignore:
Timestamp:
11/20/2009 03:01:22 AM (15 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r12222 r12237  
    15051505    // Set the limit clause, if we got a limit
    15061506    $num = (int) $num;
    1507     if ($num) {
     1507    if ( $num ) {
    15081508        $limit = "LIMIT $num";
    15091509    }
    15101510
    1511     $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";
    1512     $result = $wpdb->get_results($sql,ARRAY_A);
     1511    $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status IN ( 'draft', 'publish', 'future', 'pending', 'private' ) ORDER BY post_date DESC $limit";
     1512    $result = $wpdb->get_results($sql, ARRAY_A);
    15131513
    15141514    return $result ? $result : array();
Note: See TracChangeset for help on using the changeset viewer.