[wp-hackers] $wp_taxonomies is pretty strange - change appreciated

Jon Cave jon at lionsgoroar.co.uk
Thu Feb 10 22:13:54 UTC 2011


On Thu, Feb 10, 2011 at 9:58 PM, 24/7 <24-7 at gmx.net> wrote:
> ehm... have to write another mail: there's no way around
> $wp_taxonomies. Even if it's internal. get_taxonomies() gives you the
> taxonomies and allows to differ between builtin and custom types, but
> is missing the post types. The original question was "It is possible
> to get a list of post types asociated to a taxonomy?". The guy who
> asked wanted all unique custom post type names that are assigned to
> custom post types, so the original answer on wp stackechange was right
> and there's no solution without $wp_taxonomies.

get_taxonomies uses $wp_taxonomies internally.

Take another look at the code you posted previously. get_taxonomies is
returning an array of objects, not array of arrays. Secondly, if you
look at register_taxonomy the types you register a taxonomy to are
object types and not post types, i.e. $tax->object_type.

Whilst typing this Andrew replied again. You'll want to use his code,
but $tax->object_type and not $tax->post_type.


More information about the wp-hackers mailing list