I have a WordPress site and have a simple div with a background image in footer.php
being called from ACF options field like so:
<div id="footer" style="background-image: url('<?php the_field('footer_background', 'options'); ?>');">
This works perfectly on all my pages and templates. However, when going into a blog category (from the categories widget in the blog page) which is calling archive.php
it converts the URL to the image ID and outputs '85'
rather than the URL.
I’ve tried removing all code from archive.php except the header and footer calls incase I had something in there but still no luck. The ACF field is definitely set to ‘url’ hence it works everywhere else.
Any ideas why it converts to ID on the archive.php
page?
I was having the same problem, and I found no fix for the plugin, but I solved the situation by making a conditional statement to check if the page was a tag archive and then retrieve the attachment URL by the returned ID.
I faced the same issue. Mine was because I removed an old field and created it again with the same name on another group.
What happened is that the old ACF key remained unchanged. This very SO question was mentioned at ACF forum where I found the hint about the problem:
My old stored values all were wrong, I had to updated them to
field_60665667aa3d3
and the URL return started working again.