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
This commit is contained in:
michelvaldrighi 2004-09-27 12:41:39 +00:00
parent bb232bd2d9
commit 93a21b3596
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));