I want to use categories but I also want to remove the category pages.
/
Assumed that this category exists this URL should return a 301 and redirect to
.php
I've tried to add a category.php
to my theme but this won't work for me.
I don't want to hide posts with a specific category or remove the category base or something like that. I'm using WordPress 3.6.1.
I want to use categories but I also want to remove the category pages.
http://www.example/categories/foo/
Assumed that this category exists this URL should return a 301 and redirect to
http://example/index.php
I've tried to add a category.php
to my theme but this won't work for me.
I don't want to hide posts with a specific category or remove the category base or something like that. I'm using WordPress 3.6.1.
Hook 'template_redirect'
action hook and redirect if in category using wp_redirect
add_action('template_redirect', 'no_cat_archives');
function no_cat_archives() {
if ( is_category() ) { wp_redirect( home_url(), 301 ); exit(); }
}