WordPress.org

Make WordPress Core

Changeset 16872


Ignore:
Timestamp:
12/11/2010 06:35:47 AM (7 years ago)
Author:
dd32
Message:

Check to see if WP_Query has returned any posts before blindly accessing posts. Fixes #15771

File:
1 edited

Legend:

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

    r16470 r16872  
    338338            // Do the query
    339339            $query = new WP_Query($query);
    340             if ( $query->is_single || $query->is_page )
     340            if ( !empty($query->posts) && ($query->is_single || $query->is_page) )
    341341                return $query->post->ID;
    342342            else
Note: See TracChangeset for help on using the changeset viewer.