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.
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
This works well for me. I simply send the taxonomy slug to browser, and itterate through them with the code above.
I send by this:
You can try out this code, it worked for me. I have a taxonomy named ‘stores’ and i wanted to display 2 selected taxonomy from it. so i used a include feature.
And if you want it without the term linking you can use this