I’ve made a simple loop over a custom taxonomy ‘product_category’:
$args = array('hide_empty' => false, 'orderby' => 'term_group', 'parent' => false);
$terms = get_terms('product_categorie', $args);
foreach ($terms as $term) {
echo "<a href=''>".$term->name."</a>";
}
I’ve added a custom field ‘webshop_url’ to the taxonomy. I’ve tried multiple solutions to print that custom field in my loop, but without luck.
I’ve tried these things in my foreach loop:
echo get_field('webshop_url', 'product_categorie', $term->term_id);
echo get_field('webshop_url', $term->term_id);
It doesn’t print anything.
I know it’s possible to use get_queried_object()
on the taxonomy page itself. But that doesn’t work either in that loop.
2
Answers
Try to pass term OBJECT
May you try like this:
ACF Document