mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
get_post() should check post cache before page cache. fixes #3724
git-svn-id: http://svn.automattic.com/wordpress/trunk@4847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a8b506e705
commit
690c3604cf
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user