Replace the sanitize loop at the end of WP_Query::get_posts() with an array_map of get_post(). get_post() will ensure each object in the loop is sanitized and is of the type WP_Post. see #22162
git-svn-id: http://core.svn.wordpress.org/trunk@22238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e65187ada5
commit
7bf8c86dac
|
@ -2774,10 +2774,10 @@ class WP_Query {
|
|||
|
||||
$this->post_count = count( $this->posts );
|
||||
|
||||
// Always sanitize
|
||||
foreach ( $this->posts as $i => $post ) {
|
||||
$this->posts[$i] = sanitize_post( $post, 'raw' );
|
||||
}
|
||||
// Ensure that any posts added/modified via one of the filters above are
|
||||
// of the type WP_Post and are filtered.
|
||||
if ( $this->posts )
|
||||
$this->posts = array_map( 'get_post', $this->posts );
|
||||
|
||||
if ( $q['cache_results'] )
|
||||
update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
|
||||
|
|
Loading…
Reference in New Issue