Wordpress - Remove "Category:", "Tag:", "Author:" from the_archive_title
You can extend the get_the_archive_title
filter which I've mentioned in this answer
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
} elseif ( is_tax() ) { //for custom post types
$title = sprintf( __( '%1$s' ), single_term_title( '', false ) );
} elseif (is_post_type_archive()) {
$title = post_type_archive_title( '', false );
}
return $title;
});
Use function single_term_title()
For CPT title Without word: ‘Archive’:
If you are building custom archive template for a CPT, and want to output just the title of the CPT with no extra word like “Archive” use following function instead:
post_type_archive_title();
From developer.wordpress.org