[wp-hackers] Adding built in taxonomies to custom post types

Andrew Nacin wp at andrewnacin.com
Wed Jul 7 23:41:43 UTC 2010


On Wed, Jul 7, 2010 at 7:13 PM, Jake Goldman <
wphackers at jakemgold.myfastmail.com> wrote:

>  I'll put it inside of an init hook, but this strikes me as peculiar. I can
> confirm that the taxonomy exists and has been registered right above the
> post type registration via get_taxonomy('category')...


This is correct, unfortunately so. Because many themes and plugins have,
over the years, tried to query posts and taxonomies prior to the init hook,
we are forced load taxonomies and post types twice -- once immediately
before we load plugins, and then we re-load them again on the init hook. You
should never rely on the functionality of the former; it is only there to
prevent plugins and themes not waiting for the init hook from crumbling
apart. (http://core.trac.wordpress.org/ticket/12918)

*** PSA ***

Please please please always wait until the init hook to register post types
and taxonomies.


More information about the wp-hackers mailing list