From 64b5e801d08df19e400d1239485c3f81826976bf Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 23 Jun 2008 21:50:19 +0000 Subject: [PATCH] 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 --- wp-includes/post.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wp-includes/post.php b/wp-includes/post.php index 1e0ef4b2fd..979d27fcbc 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -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'); }