Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom taxonomy worktype and I have 3 types in this latter custom taxonomy: - creation - collaboration - lab

I have also a custom post type "works". worktype is used only for the custom posts type works

I have single-works.php as a template and everything is ok

BUT, I need to retrieve the worktype of the current single post. How can I do that ?

(the final idea: build a breadcrumb like that > ; in order to navigate a bit better)

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Use get_the_terms( $post, $taxonomy ):

$worktypes = get_the_terms( get_the_ID(), 'worktyp' );

var_export( $worktypes );

You can also use …

get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' );

… to get a formatted output. Example.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.