I'm building a custom post type that relies on three custom taxonomies. I'm registering all the custom posts and tax... using the init action (this works and I can manage the new aspects)

register_taxonomy( 'cppstrands', array( 'cppstatements' ), $args );

//Part of the cppmatrix_init method called here
add_action( 'init', 'cppmatrix_init', 0 );

I am also trying to prepopulate the tax.. with data when the plugin is activated using register_activation_hook but this fails as Taxonomy does not exist.

if(taxonomy_exists('cppstrands')) ...

//Part of the cppmatrix_dataInstall called here
register_activation_hook(__FILE__, 'cppmatrix_dataInstall');

I am suspecting that init happens before register_activation_hook but don't know what to do to solve it.

Can anyone help?


1 Answer 1


I solved this problem by putting everything into the init call and then calling a check on the tax.. to see if it was empty.

I'm not convinced that this is the most elegant solution or efficient so maybe someone will correct or confirm what I have found as a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.