I'm currently trying to create a simple search of a custom post type for job vacancies and the search includes using a couple of the custom taxonomies. I've used get_terms() to generate a drop down for each of the taxonomies, and by default it should only display terms that have posts in.
Trouble is, this includes posts in the trash. As the posts may be used in the future again, they're not going to be deleted, however, for example, there is a post/job with a location set as London, so London appears in the list of options, but when you select it (and nothing else), no results appear because the job is in the trash.
Is there any way to filter the get_terms() results easily to reduce the list to only have those with live posts as opposed to all posts? At present the only solution I can think of is to loop through each term (which I do anyway) and then check some how to see if there is at least one live post using it, which is quite a lot of processing for a simple drop down list.
Any suggestions welcome :)