On a website made with a purchased template, a custom post-type had an archive page. I didn't want that archive page, so I altered the custom post-type in a child-theme like so:
function remove_archive(){
$portfolio = get_post_type_object( 'portfolio' );
$portfolio->has_archive = FALSE;
register_post_type( 'portfolio', $portfolio );
}
add_action( 'init', 'remove_archive', 20 );
This removed the custom post-type archive. However, it was my intention that the url /portfolio would be freed up for use for a page. But even after refreshing the permalinks, clearing caches etc. the url doesn't point to the page. Instead it points to the blog page, which hasn't been set in the settings at all.
The solution should be a situation in where /portfolio
is a page, and /portfolio/*
is the URL structure for the posts. However, at this moment, that is not working in any way.
Am I missing something?
Edit
As per Pieter's comment, I've added the template filter template_include
:
function uncode_redirect_page($original_template) {
global $is_redirect;
$is_redirect_active = ot_get_option('_uncode_redirect');
if ($is_redirect_active === 'on') {
if(! is_user_logged_in() )
{
$is_redirect = true;
return get_template_directory() . '/redirect-page.php';
}
}
return $original_template;
}
add_filter('template_include', 'uncode_redirect_page');