Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End I need to get the category ID for a custom taxonomy Re: I need to get the category ID for a custom taxonomy

#123756
sanclementejoe
Participant

I figured it out with some help from this page: [http://wordpress.org/support/topic/trying-to-output-a-posts-terms-taxonomy-as-text-not-urls#post-1188801](http://wordpress.org/support/topic/trying-to-output-a-posts-terms-taxonomy-as-text-not-urls#post-1188801 “”)

// Get terms for post
$terms = get_the_terms( $post->ID , ‘stores’ );

// Loop over each item since it’s an array
foreach( $terms as $term ) {
// Print the term_id method from $term which is an OBJECT
// $lovers will be grabs the current store page id
$lovers= $term->term_id;
// Get rid of the other data stored in the object, since it’s not needed
unset($term);
}
?>

$cat_id = $lovers;
$value = get_field(‘extended_store_descriptions’, ‘stores_’ . $cat_id );
echo $value;

?>