Will McLean is a designer and artist working in the Central Coast of NSW where he lives with his wife and 2 children.

Will draws and paints out of habit and addiction. He writes about his struggles on the battlefield of art in the Art Archive section of this site.

Will is a meticulous developer and favours simplicity and clarity within his code. He can’t stand writing things twice so searches for any way to automate. His experiments can be found in the Exercises section of this site.

Will designs within systems. No project is too small for a design system. He favours the unusual, if not, how can he progress? You can read about his work in the Case Studies section of this site.

Updated: October 26, 2017

This is a Knowledge Base post.

“Disable” a WordPress post type archive page

We will not actually disable the page. As far as I can tell these cannot be disabled (please do let me know if they can). We will redirect it to the home page. Good practice, no, good for the user, no, time saving, yes. Please! If anyone has any ideas that would make this nicer please share.


function post_type_archive_template_redirect() {
    if( is_post_type_archive( 'post-type' ) ) {
        wp_redirect( home_url() );
        die;
    }
}
add_action( 'template_redirect', 'post_type_archive_template_redirect' );

Source: https://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect