attachment_url_to_postid() should always return an integer.

props nathan_dawson, ashfame.
fixes #31044.

git-svn-id: https://develop.svn.wordpress.org/trunk@31239 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2015-01-18 20:32:50 +00:00
parent a79297ba2d
commit a036114a4d
2 changed files with 12 additions and 4 deletions
+3 -4
View File
@@ -3295,7 +3295,7 @@ function wp_maybe_generate_attachment_metadata( $attachment ) {
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $url The URL to resolve.
* @return int The found post ID.
* @return int The found post ID, or 0 on failure.
*/
function attachment_url_to_postid( $url ) {
global $wpdb;
@@ -3312,9 +3312,8 @@ function attachment_url_to_postid( $url ) {
$path
);
$post_id = $wpdb->get_var( $sql );
if ( ! empty( $post_id ) ) {
return (int) $post_id;
}
return (int) $post_id;
}
/**