Support

Account

Home Forums ACF PRO File Field Returning ID instead of Array Depending on Context

Solving

File Field Returning ID instead of Array Depending on Context

  • 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.

    Any ideas? Thanks!

  • Hey mooner,

    Where you able to sort this out or are you still seeing the issue and looking for help?

  • To be honest, my code has changed and I’m not sure I have the motivation to go digging through my version control history to try and find the issue again.

    2.5 month turnaround time not ideal, but thanks for following up…

  • 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)

The topic ‘File Field Returning ID instead of Array Depending on Context’ is closed to new replies.