// It's a newly-uploaded file, therefore $file is relative to the basedir.
$url =
$uploads['baseurl'
] . "/
$file";
} } } /*
* If any of the above options failed, Fallback on the GUID as used pre-2.7,
* not recommended to rely upon this.
*/
if ( !
$url ) { $url =
get_the_guid( $post->ID
);
} // On SSL front end, URLs should be HTTPS.
if ( is_ssl() && !
is_admin() && 'wp-login.php' !==
$pagenow ) { $url =
set_url_scheme( $url );
} /**
* Filters the attachment URL.
*
* @since 2.1.0
*
* @param string $url URL for the given attachment.
* @param int $attachment_id Attachment post ID.
*/