Snippet: Disable Category, Author, Date and Tag archives

Add following snippet to “functions.php”

Snippet

add_action('template_redirect', 'wpse69948_archive_disabler');
function wpse69948_archive_disabler()
{
    if(is_tag() || is_category() || is_date() || is_author())
    {
        global $wp_query;
        $wp_query->set_404();
    }
}

Result

Snippet will redirect the category, date, tag and author links to “404 not found” page.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>