Sorry – in that case if you used that snippet you’d just return the escaped url.
return esc_url($url);
Just for a future example, because I found this on a search, the latest Elementor is really having major issues with the Link field in ACF — and if you are creating something for your clients Link is way better than URL ( url meaning the client would have to hard enter the correct url address ).
As stated earlier you’ll have to write a shortcode function in your theme ( function.php )…and then, unfortunately, it doesn’t seem as if the native shortcode link function works ( [acf field='my_link'] doesn’t work ).
Something like this:
function get_acf_link_url($atts) {
$atts = shortcode_atts(array(
'field' => '',
), $atts);
$url = get_field($atts['field']);
return "<a href='" . esc_url($url) . "'>" . esc_html($url) . "</a>";
}
add_shortcode('acf_link_url', 'get_acf_link_url');
And then create a html snippet ( not a Heading or a Text Field ):
<a href="[acf_link_url field='my_link']">Link</a>