Support

Account

Home Forums General Issues Field group at taxonomy does not work Reply To: Field group at taxonomy does not work

  • @drift2 The code provided will loop through all available terms within that taxonomy, so we have to adjust it if we’re focusing on a single term.

    $current_term = get_taxonomy( get_query_var( 'taxonomy' ) );
    $field = get_field('style_id', $current_term->taxonomy.'_'.$current_term->term_id);
    echo '<pre>field: '.print_r( $field, true).'</pre>';

    Any luck?

    Edit: sit tight, this code will fail
    UPDATE: Code for single term:

    $term = get_term_by( 'slug', $wp_query->query_vars['term'], $wp_query->query_vars['taxonomy']);
    $field = get_field('style_id', $term->taxonomy.'_'.$term->term_id);
    echo '<pre>field: '.print_r( $field, true).'</pre>';