Home › Forums › Front-end Issues › Custom taxonomy slug not ID (again, i know) › Reply To: Custom taxonomy slug not ID (again, i know)
Now the field is a Term ID, and it works, showing the numeric ID of my taxonomy.
And is a radio field.
Meanwhile i’ve uploaded my work in progress in a live server, with no improvements…
I’ve found this code and it seems to work!
<?php // Get terms for post
$terms = get_the_terms( $post->ID , 'tecnica' );
// Loop over each item since it's an array
if ( $terms != null ){
foreach( $terms as $term ) {
// Print the name method from $term which is an OBJECT
print $term->name ;
// Get rid of the other data stored in the object, since it's not needed
unset($term);
} } ?>
from here, where is also suggested to use wp_get_object_terms( $object_ids, $taxonomies, $args )
I’ve tried on new and old posts, changing the category changes correctly in the front end.
Can we marked this [resolved]?
Thanks again!
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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 18, 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.