Support

Account

Home Forums Front-end Issues get_field() on an image field returns image ID no matter what

Helping

get_field() on an image field returns image ID no matter what

  • I have an image field that I have specified to return Image Array. However, no matter what I do, it returns an ID. The array option on the image field page in the docs (https://www.advancedcustomfields.com/resources/image/) just doesn’t seem to work. I could use the ID to get the attachment meta, but I thought I’d figure out why this isn’t working.

    $hero_browser_img = get_field('hero_browser_img');
    
    echo '<pre>';
    print_r( $hero_browser_img );
    echo '</pre>';
  • In almost all cases where this happens it is caused by a pre_get_post filter that is effecting the ACF queries for the image field.

    The first step is to figure out where it is. It could be in another plugin or in your theme.

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

The topic ‘get_field() on an image field returns image ID no matter what’ is closed to new replies.