From 93a21b35961b64c94e4dfc761b4ad0e875257e9f Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Mon, 27 Sep 2004 12:41:39 +0000 Subject: [PATCH] fixed url_to_postid (it was the cause of pingbacks to the first post when a simple link to the blog was done) git-svn-id: https://develop.svn.wordpress.org/trunk@1717 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 9d4194a36f..fa6a42c7e1 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -284,6 +284,11 @@ function url_to_postid($url = '') { if ($second) $where .= " AND SECOND(post_date) = '" . intval($second) . "'"; if ($postname) $where .= " AND post_name = '" . $wpdb->escape($postname) . "' "; + // We got no indication, so we return false: + if (!strlen($where)) { + return false; + } + // Run the query to get the post ID: $id = intval($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE 1 = 1 " . $where));