I did this also, here is the code.
<?php $term = $wp_query->queried_object; ?>
<?php the_field('cat_image', $term); ?>
Thank you for your help.
Yes, thank you for your help. I have solved it. When you do Term Object instead of Term ID, it will work. And the code is for example here.
<?php
$terms = get_field('cat_related_tags', $queried_object);
if( $terms ):
foreach( $terms as $term ):
$cat_image = get_field('cat_image', $term ); ?>
endforeach;
endif;
?>
I have one more question. I am on tag.php and I am trying to get Custom Field Image. This code didn’t work here. Did I do something wrong? Thank you.
<?php $cat_image = get_field('cat_image'); ?>
<?php the_field('cat_image'); ?>
Thank you. I am looking for the “return value to Term object” in Google, but I couldn’t understand the operation logic of php codes. May I ask you to help me with the codes, please? Maybe just a little code, but I couldn’t do it.
Thank you.