mirror of
git://develop.git.wordpress.org/
synced 2025-02-27 18:13:00 +01:00
Check to see if WP_Query has returned any posts before blindly accessing posts. Fixes #15771
git-svn-id: https://develop.svn.wordpress.org/trunk@16872 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4c11a459f9
commit
416efb62b4
@ -337,7 +337,7 @@ function url_to_postid($url) {
|
||||
|
||||
// Do the query
|
||||
$query = new WP_Query($query);
|
||||
if ( $query->is_single || $query->is_page )
|
||||
if ( !empty($query->posts) && ($query->is_single || $query->is_page) )
|
||||
return $query->post->ID;
|
||||
else
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user