God! It´s a bit embarrassing when you get the answer seconds after posting the question. But instead of removing it, I´ll just leave it here as it might help someone else, just like arleym´s post helped me.
Arleym was using a file field. I am using an image field. And I need it to be like that for reasons that go beyond this topic. (obs: wordpress does not support svg in the media library natively).
Having said that, it wasn´t working because my image field was set to return the object array while it MUST be set to return the URL, instead.
So the intial code on my previous comment was correct and after changing the value returned by the image field it now works!
<?php $svgImg = get_field('my_custom_field', $term, 'option'); ?>
<?php echo file_get_contents( $svgImg ); ?>
Hope this may help somebody else.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.