You can try the slug
agument under rewrite
parameter of register_post_type()
function:
add_action( 'init', 'egister_hosts_post_type' );
function register_hosts_post_type() {
$args = array(
// ....
'rewrite' => array( 'slug' => 'programs/hosts' ),
);
register_post_type( 'hosts', $args );
}
As this affect the rewrite rules, you should flush them on activation/deactivation of the plugin:
add_action( 'init', 'cyb_register_hosts_post_type' );
function cyb_register_hosts_post_type() {
$args = array(
// ....
'rewrite' => array( 'slug' => 'programs/hosts' ),
);
register_post_type( 'hosts', $args );
}
register_activation_hook( __FILE__, 'cyb_activation_hook' );
function cyb_activation_hook() {
cyb_register_hosts_post_type();
flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'cyb_deactivation_hook' );
function cyb_deactivation_hook() {
flush_rewrite_rules();
}