Do some caching in get_postdata().
git-svn-id: http://svn.automattic.com/wordpress/trunk@2230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
01135095f3
commit
49490ac2ac
|
@ -525,23 +525,26 @@ meta_key = '$key' AND post_id = '$post_id' AND meta_value = '$prev_value'");
|
||||||
function get_postdata($postid) {
|
function get_postdata($postid) {
|
||||||
global $post, $wpdb;
|
global $post, $wpdb;
|
||||||
|
|
||||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$postid'");
|
if ( $postid == $post->ID )
|
||||||
|
$a_post = $post;
|
||||||
|
else
|
||||||
|
$a_post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$postid'");
|
||||||
|
|
||||||
$postdata = array (
|
$postdata = array (
|
||||||
'ID' => $post->ID,
|
'ID' => $a_post->ID,
|
||||||
'Author_ID' => $post->post_author,
|
'Author_ID' => $a_post->post_author,
|
||||||
'Date' => $post->post_date,
|
'Date' => $a_post->post_date,
|
||||||
'Content' => $post->post_content,
|
'Content' => $a_post->post_content,
|
||||||
'Excerpt' => $post->post_excerpt,
|
'Excerpt' => $a_post->post_excerpt,
|
||||||
'Title' => $post->post_title,
|
'Title' => $a_post->post_title,
|
||||||
'Category' => $post->post_category,
|
'Category' => $a_post->post_category,
|
||||||
'post_status' => $post->post_status,
|
'post_status' => $a_post->post_status,
|
||||||
'comment_status' => $post->comment_status,
|
'comment_status' => $a_post->comment_status,
|
||||||
'ping_status' => $post->ping_status,
|
'ping_status' => $a_post->ping_status,
|
||||||
'post_password' => $post->post_password,
|
'post_password' => $a_post->post_password,
|
||||||
'to_ping' => $post->to_ping,
|
'to_ping' => $a_post->to_ping,
|
||||||
'pinged' => $post->pinged,
|
'pinged' => $a_post->pinged,
|
||||||
'post_name' => $post->post_name
|
'post_name' => $a_post->post_name
|
||||||
);
|
);
|
||||||
return $postdata;
|
return $postdata;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue