How to get_term_meta on single custom post?

Question

I added custom image and icon to my custom taxonomy, and I know how to display it in the front end in the taxonomy template page.

$headImageId = get_term_meta( get_queried_object_id(), 'category-image', true );
$headImageUrl = ( ( $headImageId != '' ) ? wp_get_attachment_url( $headImageId ) : '' );

But how do I call it in my single post template? I want to use the image from the taxonomy term the custom post belongs to as a header background. I can’t get my head around this..

0
, , , , Cynthia Lara 8 months 0 Answers 97 views 0

Leave an answer