From 9d428766b08333bc18bce984e3bd86271d985271 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: http://svn.automattic.com/wordpress/trunk@1717 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 9d4194a36..fa6a42c7e 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));