How I fixed Wordpress category page title: Category <span>...</span>
One one of my Wordpress sites, the title of category pages was literally
Category <span>My category</span>
Searching through the theme source code didn’t yield a solution quickly, so I added this custom JS using a plugin:
jQuery(document).ready(function( $ ){
if(jQuery("h1.page-title").text().includes("Category: <span>")) {
var input = jQuery("h1.page-title").text();
var output = /<span>(.*)<\/span>/g.exec(input)[1];
jQuery("h1.page-title").text(output);
}
});
This will just replace the title by the content of the span tag. You might need to adjust the CSS classes for your theme.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow