Support

Account

Home Forums General Issues get_field not returning values Reply To: get_field not returning values

  • Hi @randalthesecond

    I’m 99% sure your issue is that you attempt to get the value outside of it’s context. That means that you might be trying to fetch it outside of the loop. Or from a term/user/object that’s not a post object and thus need the second parameter.

    Just throwing in $post_id won’t help you. what @imaginedd is trying to say here is that you probably need to specify this second parameter and if it’s a field belonging to a post object you have to find the posts ID and pass it as the second parameter. For example, if you’re working outside the loop and not in a single.php or page.php you might get away with:

    
    global $post;
    if( get_field('enable_box', $post->ID) ){
      //Table with other ACF field values
    }
    

    We can’t help you further without more information about your setup tho so get those images working 🙂