Get rid of WordPress category, tag and author archives?

I have searched the net with no success on what should be an easy thing.

I have a highly customized blog with pages, sub pages and posts. While I rely heavily on the use of categories and tags I don’t want them to be viewable in a url. The same goes for authors and date categories. Basically I wan’t to throw a 404 error if someone tries to access these pages. Can someone point me in the right direction? Thanks!

The following should not be accessible:

example.net/category/books/

example.net/tag/ebooks/

example.net/author/dickens/

example.net/2012/10/

2 s
2

building on chrisguitarguy’s answer here is a quick snippet you can drop in your theme’s functions.php file to do job

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();
    }
}

Leave a Comment