Improve sanitize_post() performance. Perform raw filtering only once. Add filter check to eliminate double filtering. Props johanee. fixes #10972 see #10801

git-svn-id: https://develop.svn.wordpress.org/trunk@12062 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2009-10-19 21:28:44 +00:00
parent 395f0b9e2d
commit 83ad1ab1a8
2 changed files with 25 additions and 6 deletions
+7 -1
View File
@@ -2360,9 +2360,15 @@ class WP_Query {
if ( !$q['suppress_filters'] )
$this->posts = apply_filters('the_posts', $this->posts);
$this->post_count = count($this->posts);
// Sanitize before caching so it'll only get done once
for ($i = 0; $i < $this->post_count; $i++) {
$this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
}
update_post_caches($this->posts);
$this->post_count = count($this->posts);
if ($this->post_count > 0) {
$this->post = $this->posts[0];
}