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>';
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.