Exclude URL’s from sanitize_html_classes

On input, esc_url_raw() is the correct function to use which replaces sanitize_url

Example :

$custom_field = esc_url_raw( get_post_meta( get_the_ID(), '_custom_url', true ) );