Support

Account

Home Forums General Issues True / False Field Always Returns False Reply To: True / False Field Always Returns False

  • Using the last example from the OP, it is almost there. The correct post_id value needs to be given for all get_field() calls when dealing with anything that is not a “post”.

    
    $queried_object = get_queried_object();
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;
    $post_id = $taxonomy.'_'.$term_id
    
    $custom_field = get_field('show_medsafe_id', $post_id);
    
    if ($custom_field) {
      echo 'NZ Medsafe ID: '.get_field('medsafe_id', $post_id);
    }