Home › Forums › General Issues › Multiple custom post types by custom taxonomy on same page › Reply To: Multiple custom post types by custom taxonomy on same page
I’m pretty sure that a taxonomy field stores an array terms IDs, or if you have it set to return term objects then it returns an array of term objects. See the image below. If you want to use the returned value in queries like this those should be the settings of your taxonomy field. Then change your query slightly.
<?php
$taxterms = get_field("collectiona");
$args = array(
'post_type' => 'products',
'tax_query' => array(
array(
'taxonomy' => 'product-collections',
'field' => 'id',
'terms' => $taxterm, // remove ->term_id
)
)
);
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.