Skip to main content
fully answer the question!
Source Link
chrisguitarguy
  • 21.5k
  • 5
  • 62
  • 99

I wrote a plugin for this -- that needs some updating, but it should still work fine.

Essentially you hook in some place late after WordPress knows what page is requested (like template_redirect), use one of the conditional functions and either use $wp_query->set_404() or just redirect the user to a page of your choice.

To disable categories, tags, for instanceauthor and date archives:

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

I wrote a plugin for this -- that needs some updating, but it should still work fine.

Essentially you hook in some place late after WordPress knows what page is requested (like template_redirect), use one of the conditional functions and either use $wp_query->set_404() or just redirect the user to a page of your choice.

To disable tags, for instance:

<?php
add_action('template_redirect', 'wpse69948_tag_disabler');
function wpse69948_tag_disabler()
{
    if(is_tag())
    {
        global $wp_query;
        $wp_query->set_404();
    }
}

I wrote a plugin for this -- that needs some updating, but it should still work fine.

Essentially you hook in some place late after WordPress knows what page is requested (like template_redirect), use one of the conditional functions and either use $wp_query->set_404() or just redirect the user to a page of your choice.

To disable categories, tags, author and date archives:

<?php
add_action('template_redirect', 'wpse69948_tag_disabler');
function wpse69948_tag_disabler()
{
    if(is_tag() || is_category() || is_date() || is_author())
    {
        global $wp_query;
        $wp_query->set_404();
    }
}
Source Link
chrisguitarguy
  • 21.5k
  • 5
  • 62
  • 99

I wrote a plugin for this -- that needs some updating, but it should still work fine.

Essentially you hook in some place late after WordPress knows what page is requested (like template_redirect), use one of the conditional functions and either use $wp_query->set_404() or just redirect the user to a page of your choice.

To disable tags, for instance:

<?php
add_action('template_redirect', 'wpse69948_tag_disabler');
function wpse69948_tag_disabler()
{
    if(is_tag())
    {
        global $wp_query;
        $wp_query->set_404();
    }
}