Hi,
I created a custom Taxonomy and attached a checkbox field to it. Now I’m struggling to retrive the data, get_field()
returns false. The fields are correctly saved through the UI panel.
function selectArchetype()
{
$terms = get_terms([
'taxonomy' => 'archetype',
'hide_empty' => false,
]);
foreach ($terms as $term) {
$fields = get_field('must_have_cards', $term->slug );
var_dump($fields);
}
}
Any idea would be appreciated. Thanks.
Hi @brevalessio
Thanks for the post.
I would recommend that you pass the actual $term object like so:
function selectArchetype()
{
$terms = get_terms([
'taxonomy' => 'archetype',
'hide_empty' => false,
]);
foreach ($terms as $term) {
$fields = get_field('must_have_cards', $term);
var_dump($fields);
}
}
Yeah, thanks, this solved my question.