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
This commit is contained in:
michelvaldrighi 2004-09-27 12:41:39 +00:00
parent 802bd72016
commit 9d428766b0
1 changed files with 5 additions and 0 deletions

View File

@ -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));