How to remove “Category:” in title from category pages



Here are the codes to remove “Category:” in title from category pages. Put them in functions.php.

add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
//being a category your new title should go here
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '' . get_the_author() . '' ;
}
return $title;
});

 

Leave a Reply