get_post() should check post cache before page cache. fixes #3724

git-svn-id: https://develop.svn.wordpress.org/trunk@4847 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2007-01-31 03:43:02 +00:00
parent 0db117a5b6
commit fb8f9d400a
1 changed files with 3 additions and 3 deletions

View File

@ -105,10 +105,10 @@ function &get_post(&$post, $output = OBJECT) {
$post_cache[$blog_id][$post->ID] = &$post; $post_cache[$blog_id][$post->ID] = &$post;
$_post = & $post_cache[$blog_id][$post->ID]; $_post = & $post_cache[$blog_id][$post->ID];
} else { } else {
if ( $_post = wp_cache_get($post, 'pages') ) if ( isset($post_cache[$blog_id][$post]) )
return get_page($_post, $output);
elseif ( isset($post_cache[$blog_id][$post]) )
$_post = & $post_cache[$blog_id][$post]; $_post = & $post_cache[$blog_id][$post];
elseif ( $_post = wp_cache_get($post, 'pages') )
return get_page($_post, $output);
else { else {
$query = "SELECT * FROM $wpdb->posts WHERE ID = '$post' LIMIT 1"; $query = "SELECT * FROM $wpdb->posts WHERE ID = '$post' LIMIT 1";
$_post = & $wpdb->get_row($query); $_post = & $wpdb->get_row($query);