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

git-svn-id: http://core.svn.wordpress.org/trunk@21559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren
2012-08-20 19:47:52 +00:00
parent ef9743af7c
commit 9377523bce
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 ) );