The problem is the initialization in WordPress via register_activation_hook( __FILE__, 'activate_IWCollege_Courses' );
The function was fired on the Activation of a plugin, not more. You must switch to the hook init
. For Custom Post types, the init hook is recommended in the codex. Custom post types must be registered during every WordPress initialization.
But the important part flush_rewrite_rules();
in your activation method should be run only on activation to rewrite the permalinks. For this function is it right, that it init about the register_activation_hook()
.
A pseudo example for your problem.
register_activation_hook( __FILE__, 'example_activate' );
function example_activate() {
flush_rewrite_rules();
}
add_action( 'init', 'example_register_cpt' );
function example_register_cpt() {
// All with the goal of:
register_post_type();
// And
register_taxonomy();
// much more, that run always on WP
}