Hello
Where am I going wrong here? I have a taxonomy category select acf field, and want to add the id to my loop…
$args = array(
'posts_per_page' => '6',
'cat' => the_field('which_category'),
);
The acf field it set to return Term ID. If I type the term ID in manually, it works. And if I just stick the_field(‘which_category’) on the page anywhere, it outputs the right number.
Thanks
Hello…
You are close here.
the_field(‘which_category’) echo’s the value…
get_field(‘which_category’) retrieves it (to store in a variable, pass to an array, etc.)
Use: get_field(‘which_category’) in this case, and that should fix this up for you.
It is really nice and informative post