Don't get post ancestors if post not found. Props Sam_a. fixes #6953
git-svn-id: http://svn.automattic.com/wordpress/trunk@8173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cdc53fcb86
commit
3a3c029662
@ -170,6 +170,8 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
|
|||||||
$post = (int) $post;
|
$post = (int) $post;
|
||||||
if ( ! $_post = wp_cache_get($post, 'posts') ) {
|
if ( ! $_post = wp_cache_get($post, 'posts') ) {
|
||||||
$_post = & $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post));
|
$_post = & $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post));
|
||||||
|
if ( ! $_post )
|
||||||
|
return $null;
|
||||||
_get_post_ancestors($_post);
|
_get_post_ancestors($_post);
|
||||||
wp_cache_add($_post->ID, $_post, 'posts');
|
wp_cache_add($_post->ID, $_post, 'posts');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user