Tagged: categories, category, category pages
Hi all,
Is there a way to completely remove all category pages from my Enfold site?
Thanks!
D
Hey sdigit,
I’m not sure if that would be possible, but if you remove the actual categories then the category pages would disappear as well?
Best regards,
Rikard
Hi Rikard,
Thanks for the response!
We use categories for a number of purposes, so we would like to keep them.
However the category pages are not useful to us, so we’d like to prevent users and search engines from accessing them.
Is there not some possible modification of code to achieve this?
Kind regards,
D
Hi,
According to this article this function should work. Try adding this code to the end of your functions.php file in Appearance > Editor:
/* 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
}
}
Best regards,
Mike