Don't get post ancestors if post not found. Props Sam_a. fixes #6953

git-svn-id: https://develop.svn.wordpress.org/trunk@8173 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-06-23 21:50:19 +00:00
parent 9a91dc90c6
commit 64b5e801d0
1 changed files with 2 additions and 0 deletions

View File

@ -170,6 +170,8 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
$post = (int) $post;
if ( ! $_post = wp_cache_get($post, 'posts') ) {
$_post = & $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post));
if ( ! $_post )
return $null;
_get_post_ancestors($_post);
wp_cache_add($_post->ID, $_post, 'posts');
}