Introduce WP_Post class. Clean up ancestors handling. Props scribu, toppa. fixes #10381 see #21309

git-svn-id: https://develop.svn.wordpress.org/trunk@21559 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2012-08-20 19:47:52 +00:00
parent 453941f725
commit 30218d5ea5
6 changed files with 167 additions and 116 deletions

View File

@@ -2643,19 +2643,20 @@ class WP_Query {
if ( $ids ) {
$this->set_found_posts( $q, $limits );
_prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
$this->posts = array_map( 'get_post', $ids );
$this->posts = $ids;
} else {
$this->found_posts = $this->max_num_pages = 0;
$this->posts = array();
$this->found_posts = $this->max_num_pages = 0;
}
} else {
$this->posts = $wpdb->get_results( $this->request );
$this->set_found_posts( $q, $limits );
}
// Convert to WP_Post objects
$this->posts = array_map( 'get_post', $this->posts );
// Raw results filter. Prior to status checks.
if ( !$q['suppress_filters'] )
$this->posts = apply_filters_ref_array('posts_results', array( $this->posts, &$this ) );