Home › Forums › General Issues › Show custom field from paired taxonomy
I have got taxonomy “catalog” where I have custom field “producer” which is from to other taxonomy. In producer page I would like to show all catalogs which are assigned to this producer. Same thing I would like to do in “category” taxonomy. I’m not sure that I explained it clearly, so I tried to create a schema. Thanks…
What you want to do is very similar to this https://www.advancedcustomfields.com/resources/querying-relationship-fields/ except that you’d be using querying “catalog” based on the taxonomy field and using the term ID value instead of the post ID value.
$args = array(
'taxonomy' => 'catalog',
'meta_query' => array(
array(
'key' => 'producer'
'value' => '"'.$term_id.'"',
'compare' => 'LIKE'
)
)
);
get_terms($args);
What you want to do is very similar to this https://www.advancedcustomfields.com/resources/querying-relationship-fields 8 ball pool except that you’d be using querying “catalog” based on the taxonomy field and using the term ID value instead of the post ID value.
I did everything, thanks for help.
Thank you @hube2 and @kimclarke it works fine, but… I can’t see customes fileds I see only defaults:
Array
(
[0] => WP_Term Object
(
[term_id] => 655
[name] => Adalit
[slug] => adalit
[term_group] => 0
[term_taxonomy_id] => 655
[taxonomy] => katalog
[description] =>
[parent] => 0
[count] => 0
[filter] => raw
[term_order] => 0
)
)
P.S. my taxonomy haven’t got any posts (and it never get them), it’s only taxonomy with customes fields
@tsinicakdex-cz getting a term does not get the ACF fields used on that term. https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/
The topic ‘Show custom field from paired taxonomy’ is closed to new replies.
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.