I have a custom post type called "destinations" and I have set the EP mask for the post type to default EP_PERMALINK. I have added a couple of endpoints as follows :
add_filter( 'query_vars', 'add_query_vars');
function add_query_vars($vars){
$vars[] = "tours";
$vars[] = "activities";
return $vars;
}
add_action('init', 'add_endpoints');
function add_endpoints(){
global $wp_rewrite;
add_rewrite_endpoint('tours', EP_PERMALINK);
add_rewrite_endpoint('activities', EP_PERMALINK);
$wp_rewrite->flush_rules();
}
Now if I test this on a normal post it redirects to the template that I need it to (I have a template redirect for the single template hook)
ie. somesite.com/test-category/test/activities/
But for the post type (which is hierarchical) it just removes the endpoint from the url and stays on the single-destination.php template
ie. somesite.com/destination/south-africa/kruger-national-park/activities/
becomes
somesite.com/destination/south-africa/kruger-national-park/
Any help or guidance will be greatly appreciated. I have been struggling with this for hours and no results :(
Thanks