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:
parent
9a91dc90c6
commit
64b5e801d0
@ -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');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user