Search code examples
wordpresstaxonomyposts

Only displaying a posts selected taxonomy terms?


When using wp_get_post_terms() I can produce a list of taxonomy terms associated with a post. However, I only want to show the taxonomy terms that have been selected for that post. Using the aforementioned function and get_terms() will successfully find the taxonomy terms, but it will show all of the terms. Not only the ones that have been selected. In the $args array for the functions I've looked for a 'selected' filter, but I found none and when I tried it, it didn't work.

Am I trying to do something that can't be done? I'm sure it's something that is starring me right in the face. I just want to ask the pro's before I make major changes to the way I'm doing things.


Solution

  • wp_get_post_terms only returns terms that have been selected for that post, it doesn't return all taxonomy terms.

    http://codex.wordpress.org/Function_Reference/wp_get_post_terms