I've written a function to collect some data from the front-end of a site and create a custom post type, then associate that CPT (which is a CPT-onomy) with another CPT using
$cpt_onomy-> wp_set_object_terms( ... )
I was doing this in a function that hooked
init. I ran into an issue where I kept getting a WP Error object returned with the message "Invalid taxonomy". The CPT-onomy was correctly registered and I checked that the taxonomy was definitely registered by hooking the
registered_taxonomy action. In the end I tried a later action; Instead of
init I hooked
wp_loaded and my problem vanished.
So I suppose my question is which action do you recommend hooking for this kind of task? What's the earliest action we can hook such that we don't get in there before CPT-onomies has had a chance to set everything up appropriately?
Great plugin by the way. Awesome idea and great documentation.