Disable WordPress Categories, User, Tag, and Date Slug

When you need run wordpress with good SEO practical, you need to remove slug permalink for categories, user tag and date slug. just copy script bellow into your theme function.php file…

/* Register template redirect action callback */
add_action('template_redirect', 'meks_remove_wp_archives');

/* Remove archives */
function meks_remove_wp_archives(){
//If we are on category or tag or date or author archive
if( is_category() || is_tag() || is_date() || is_author() ) {
global $wp_query;
$wp_query->set_404(); //set to 404 not found page
Posted in ,

Leave a Comment