This WordPress snippet hooks into the get_the_archive_title filter to clean up the default page titles displayed on archive pages.
function custom_titles($title) {
if(class_exists( 'WooCommerce' )) {
$is_woo_page = is_shop() || is_product_category() || is_product_tag();
} else {
$is_woo_page = false;
}
if ($is_woo_page || is_category() || is_tag() || is_date() || is_author()) {
$title = str_replace(':', '', ltrim($title, strtok($title, ':')));
$title = str_replace('</span>', '', $title);
$title = str_replace('<span>', '', $title);
}
return $title;
}
add_filter('get_the_archive_title', 'custom_titles');