WordPress.org

Make WordPress Core

Changeset 18846


Ignore:
Timestamp:
09/30/2011 07:06:18 PM (7 years ago)
Author:
ryan
Message:

Avoid refetching a post in get_post() when passed a post object that has already been raw sanitized. Clean up sanitize loop. Props scribu. fixes #18822

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r18845 r18846  
    382382        $_post = sanitize_post($post, 'raw');
    383383        wp_cache_add($post->ID, $_post, 'posts');
     384    } elseif ( is_object($post) && 'raw' == $post->filter ) {
     385        $_post = $post;
    384386    } else {
    385387        if ( is_object($post) )
  • trunk/wp-includes/query.php

    r18838 r18846  
    27462746        $this->post_count = count($this->posts);
    27472747
    2748         // Sanitize before caching so it'll only get done once
    2749         for ( $i = 0; $i < $this->post_count; $i++ ) {
    2750             $this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
     2748        // Always sanitize
     2749        foreach ( $this->posts as $i => $post ) {
     2750            $this->posts[$i] = sanitize_post( $post, 'raw' );
    27512751        }
    27522752
Note: See TracChangeset for help on using the changeset viewer.