[wp-hackers] advice on plugin functionality

Paul paul at codehooligans.com
Sat Dec 18 13:53:51 UTC 2010


All,

So I have my little plugin, Media-Tags. This plugin adds a new taxonomy and some UI hook to allow tagging (non-heirarchial) or attachments. This plugin works pretty well and has been for the past two years. Of the handful of template functions users can call from their theme is a function list_mediatags which functions and performs much like the functions for listing post tags in the sidebar. 

I just had someone post a comment on my blog asking if there was an easy was to exclude or hide the media-tags term for posts that are not published. In my thinking the media-tags term is associated to the attachment not the parent of the attachment. So when I use standard WP functions like get_terms I'm returned the list of terms in the media-tags taxonomy. 

Can anyone think of an easy way to do this using standard WordPress logic? Or I should say other than looping through all the terms. Then looping through that term's attachments. Then getting the attachment's parent post_status for each item?

I'm thinking this is the only solution but I know there are folks lot smarter than I am on this list. 

P-


More information about the wp-hackers mailing list