Home › Forums › General Issues › Echo Taxonomy field IDs to WP Query › Reply To: Echo Taxonomy field IDs to WP Query
Assuming the $cats
is receiving values it seems like you’ll want to update the code to:
<?php
$cats = get_field('rel_posts_cat');
$my_query = new WP_Query(array(
'showposts' => '10',
'category__and' => $cats,
));
while ( $my_query->have_posts() ) : $my_query->the_post();
?>
The change is on the 'category__and'
parameter, since $cats should be returning an array assuming you’ve defined the Return Value
to 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.