Support

Account

Home Forums General Issues Image Field Only Returns Image ID

Solving

Image Field Only Returns Image ID

  • Hi– I’m not having much luck with the ‘Image’ field; even if I have ‘Image URL’ selected for the ‘Return Format’, only the ID is returned rather than the image’s URL.

    Image field issue

    Image field issue

    Anyone have any ideas?

    Thanks!
    Bryan

  • Did you find a solution to this? I got the same issue. Sure you could use the id to get the src but I’m using WP headless and therefore needs the url / object returned through the API, which it doesn’t.

  • The most likely reason for this is a pre_get_posts action that is interfering with the ACF query that is run when getting the image post. The usual case for this is not checking that the pre_get_posts filter is acting on the “Main Query” [is_main_query()]. There could be other issues, but 90% of the time this is the cause.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.