From 436bdde04c0e035104912911fa0cae8807491f03 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 15 Oct 2012 20:42:57 +0000 Subject: [PATCH] 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: https://develop.svn.wordpress.org/trunk@22238 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/query.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 60228dbbec..9ab77b02f4 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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']);