Hot answers tagged


The solution is to use: 'taxonomy' => 'meal', 'field' => 'slug', 'terms' => 'breakfast' The taxonomy and terms are obvious, but why does field have to be slug? When you add taxonomy parameters, you can specify what 'breakfast' is-- via the field. It could be the term's ID, the full name, or slug. See the codex on Taxonomy Parameters


get_terms() doesn't have built-in feature that excludes draft posts because it keeps track of only total posts term is attached to. I made a quick search and found this snippet but be warned: It affects all get_terms() functions on your site (I excluded admin area) There's a SQL query in foreach loop - it will affect performance More terms returned == ...

Only top voted, non community-wiki answers of a minimum length are eligible