Hey, so I have a piece of template code which I am sharing between two templates using get_template_part('', '')
On one of the templates, ‘search.php’ a file field I have is working just fine, but on ‘tags.php’ the get_field function returns just the attachment ID instead of the full Array as it is set to do. Again, the ‘search.php’ and ‘tags.php’ share the same code for the loop which includes the get_field call.
There is an obvious workaround which is to test the result of the get_field call and if it is an Array do the usual otherwise I can use functions like wp_get_attachment_url(), etc. but this still seems like a bug to me since the field is supposed to be returning an Array.
I tried debugging things a bit and it seems that for some reason on the ‘tags.php’ template, line 1060 of api-field.php $posts = get_posts( $args ); returns an empty result, even though the arguments being passed to it are exactly the same as on ‘search.php’ when I var_dump their contents.
Yes, Elliot is trying to rectify the problems, which is why me an a couple of others are now working the forums. One of my goals is to clean up old questions and I know in many cases that the problem will be either non-existent or solved in some other way.
All I can say is that in the future questions get faster attention.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users