Crumina Redirect to custom portfolio page instead of archive page

Created by Alex Crumina
1
2
3
4
5
6
7
8
// Redirect to custom portfolio page instead of archive page.
function archive_to_custom_archive() {
    if( is_post_type_archive( 'portfolio' ) ) {
        wp_redirect( home_url( '/portfolio/' ), 301 );
        exit();
    }
}
add_action( 'template_redirect', 'archive_to_custom_archive' );

Comments (0)