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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U
— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.
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.