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

Andrew Nacin wp at andrewnacin.com
Thu Feb 10 18:52:42 UTC 2011

On Thu, Feb 10, 2011 at 9:46 AM, 24/7 <24-7 at gmx.net> wrote:

> Hi list,
> i just answered a question about assigned post types for taxonomies on
> wordpress.stackexchange [1], that needed to get the data from the
> $wp_taxonomies array. I found working with it to be pretty non-handy.
> From a "what is it" perspective it really makes sense to set every
> custom taxonomy equal with category (key = 0), post tag (1), nav_menu
> (2) & link_category(3) - they are still taxonomies, but from nearly
> every use case with the wp_taxonomies array it's just ... non-handy.
> In most cases you won't set the build in taxonomies equal to your
> custom ones. You registered them, because the build in stuff didn't
> fit your needs. With the current setup there's the need for some ugly
> work arounds/hacks to exclude the build in taxonomies. It would really
> make sense if custom taxonomies would reside in only one array (key 4)
> and therefore be easier accessible/loop-able. Going one step further
> and registering this new array as a separate global available $var
> would make even more sense.
> So here goes my question to all people who have enough in-depth
> knowledge: Would this be possible or is $wp_taxonomies that deeply
> nested, that changing this is impossible?
> Thanks.
> - Kaiser.
> Ps.: As you can read in my statement before the code, i wrote it
> without testing. I hope the guy who asked the question will edit my
> code and replace it with his, so don't kill me for this (verbally).
> [1]
> http://wordpress.stackexchange.com/questions/9060/it-is-possible-to-get-a-list-of-post-types-asociated-to-a-taxonomy/9064#9064

$wp_taxonomies is internal, private. Use get_taxonomies() instead.

If you want to override built-in taxonomies, be aware that isn't currently
supported, and the sky may fall on your head.


More information about the wp-hackers mailing list