Hi I have a custom taxonomy with a term meta flag called ‘is_live’ set up and I want to exclude all the terms where this flag is false when I call wp_dropdown_categories.
I’ve checked the codex but cant see anything relating to terms meta.
Anyone have any ideas or tried this before?
There is no direct way, hence you’ll have to hack it.
wp_list_categories
callsget_terms
internally. There’s a filterterms_clauses
which will allow you to modify theWHERE
conditions for getting the terms. Here’s how you can use it:Append your
WHERE
condition to the defaultWHERE
condition. I’m not very good with SQL (honestly, I couldn’t find where term meta is stored!) hence didn’t write the query. For more reference you can check the filetaxonomy.php
(line. no. 1311) and these 2 posts: Link 1, Link 2.Hope it helps!