How to Remove “Category:” From Category Archive Pages in WordPress

WordPress provides all the basic functionality for blogging and rapid website development. The majority of bloggers use WordPress for their blogs and affiliate websites because WordPress is SEO friendly.

Also, WordPress has archives feature, which is quite helpful for bloggers to generate categories and author archives.

By default, category archives title published with prefix “Category: “, however it may change according to themes.

Read More: Add Custom Link in WP-Admin Sidebar

Remove “Category:” Prefix From Category Archive Title

Category prefix in title varies according to theme. But, we can remove category prefix from the title of the archive page. Even more, we can also remove other archive prefixes using the below code.

Just add the below code at the end of the functions.php file.

Code

//custom archive header
add_filter( 'get_the_archive_title', 'errorsea_archive_title' );
function errorsea_archive_title( $title ) {
	if ( is_category() ) {
		// Remove prefix in category archive page
		$title = single_cat_title( '', false );
	} elseif ( is_tag() ) {
		// Remove prefix in tag archive page
		$title = single_tag_title( '', false );
	} elseif ( is_author() ) {
		// Remove prefix in author archive page
		$title = get_the_author();
	}
	return $title;
}

Explanation

In the above code, we have registered a new function to filter the default titles of category, tag, and author archives.

Conclusion

I hope now you can remove the category: prefix from the category archives title. You can also add another prefix or postfix to the title according to your SEO requirement.

Happy Blogging 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Read previous post:
Add a New Custom Link in WordPress Sidebar
How to Add a New Custom Link in WordPress Sidebar

WordPress is quite famous for its flexibility and advancements. Even more, WordPress provides a friendly and powerful admin panel to...

Close