I have a custom post type of ‘treatment’ on my site. I want the url to be (for a single CPT): mysite.com/treatments/name-of-treatment
If I use a function eg:
add_filter( ‘register_post_type_args’, ‘wpse247329_register_post_type_args’, 10, 2 );
function wpse247329_register_post_type_args( $args, $post_type ) {
if ( ‘treatment’ === $post_type ) {
$args[‘rewrite’][‘slug’] = ‘treatments’;
}
return $args;
}
then my page (mysite.com/treatments) no longer uses the custom page template I have set up for it; it just defaults to a normal standard layout for an Archive page.
Any ideas how to stop affecting the custom page template when I rewrite the slug for the singular CPT?
[ad_2]