I'm writing a plugin and my question is:
Which is the most suitable point in which to place the code to register a custom_post_type, or a taxonomy: "init action", or "activation_hook" ???
1) init action
add_action( 'init', 'create_my_taxonomy' );
function create_my_taxonomy() {
register_taxonomy( . . .);
}
2) activation_hook
register_activation_hook( __FILE__, 'activate_myplugin' );
function activate_myplugin() {
create_my_taxonomy();
. . .
}
function create_my_taxonomy() {
register_taxonomy( . . .);
}
remark
the documentation example as init action, but I suspect that activation_hook is more correct
but perhaps it is indifferent