I'd like to get term data from a custom taxonomy associated with the current post.

I can do this with get_the_term_list($id $custom_taxonomy). However, this returns the data I want wrapped in HTML.

I'd like to get the data but not wrapped in HTML.

I presume this means using a function that returns an object, and from that point I'd work with the object. get_terms looks like a likely candidate. But I haven't been able to craft the parameters correctly.

How exactly can I get the data I want?


OK, so let's make it straight:


Returns an HTML string of taxonomy terms associated with a post and given taxonomy. Terms are linked to their respective term listing pages.

So it will generate HTML code and return it as string.


Retrieves the terms in a given taxonomy or list of taxonomies.

So it has nothing to do with current post.


Retrieve the terms of the taxonomy that are attached to the post.

So this is the one you're looking for, I guess.

It will get the terms of given taxonomy that are assigned to given post and return them as array - so you can iterate it and do whatever you want with them...

  • This cleared things up nicely and gave me a path to a solution. Thanks! – bob May 30 '18 at 22:45
  • @bob No problem :) – Krzysiek Dróżdż May 30 '18 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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