Is there an easy way of obtaining every registered taxonomy and for each registered taxonomy, get all the terms for that taxonomy, and for each term, get the post count, without actually fetching all of the post data?
I would assume it is most definitely possible. I would also assume it requires some massively long database query using $wpdb
.
You can do this with just
get_terms
– this allows you to fetch all (or some) of the terms from one (or more) taxonomies.By default it excludes ’empty’ terms, so you’ll need to set the arguments appropriately.
If you wish to obtain an array of registered taxonomies programmatically you can use
get_taxonomies()