WordPress.org

Make WordPress Core

Changeset 10214


Ignore:
Timestamp:
12/16/08 23:51:38 (5 years ago)
Author:
ryan
Message:

Don't cache filtered post objects. Set filter when getting sample permalink. Props brianwhite. fixes #8526 for 2.7

Location:
branches/2.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7/wp-admin/includes/post.php

    r10203 r10214  
    910910    } 
    911911 
     912    $post->filter = 'sample';  
     913 
    912914    $permalink = get_permalink($post, true); 
    913915 
     
    927929    $post->post_date = $original_date; 
    928930    $post->post_name = $original_name; 
     931    unset($post->filter); 
     932 
    929933    return $permalink; 
    930934} 
  • branches/2.7/wp-includes/link-template.php

    r10150 r10214  
    9393    ); 
    9494 
    95     $post = &get_post($id); 
     95    if ( is_object($id) && isset($id->filter) && 'sample' == $id->filter ) 
     96        $post = $id; 
     97    else 
     98        $post = &get_post($id); 
    9699 
    97100    if ( empty($post->ID) ) return false; 
  • branches/2.7/wp-includes/post.php

    r10150 r10214  
    216216        else 
    217217            return $null; 
    218     } elseif ( is_object($post) ) { 
     218    } elseif ( is_object($post) && empty($post->filter) ) { 
    219219        _get_post_ancestors($post); 
    220220        wp_cache_add($post->ID, $post, 'posts'); 
    221221        $_post = &$post; 
    222222    } else { 
     223        if ( is_object($post) ) 
     224            $post = $post->ID; 
    223225        $post = (int) $post; 
    224226        if ( ! $_post = wp_cache_get($post, 'posts') ) { 
     
    793795        foreach ( array_keys(get_object_vars($post)) as $field ) 
    794796            $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context); 
     797        $post->filter = $context; 
    795798    } else { 
    796799        if ( !isset($post['ID']) ) 
     
    798801        foreach ( array_keys($post) as $field ) 
    799802            $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context); 
    800     } 
     803        $post['filter'] = $context; 
     804    } 
     805 
    801806    return $post; 
    802807} 
Note: See TracChangeset for help on using the changeset viewer.