The WordPress uploads directory’s path and URL are determined by the wp_upload_dir()
function which applies a filter named upload_dir
which you can use to fix the double slashes in the attachment URL.
So if you turned off the “Organize my uploads into month- and year-based folders” setting, try the following:
add_filter( 'upload_dir', function ( $data ) {
$data['baseurl'] = untrailingslashit( $data['baseurl'] );
return $data;
} );
And you can actually use the upload_dir
filter to change the uploads directory path/URL/etc. without having to use the UPLOADS
constant..