How To

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 🙂

Nachiket Panchal

Founder & Administrator of `errorsea` Having interest in Programming & Technology.

Recent Posts

5 Important Things To Know About WordPress Before You Use It

There is a reason big-name companies like CNN use WordPress. WordPress is a popular content…

3 years ago

How to Install MySQL on Your PC in 3 Easy Steps

In this tutorial, I'm going to show you how to install MySQL on your computer.…

4 years ago

Download and Install Turbo C++ for Windows 10 (Full Installation Guide)

Download Turbo C++ for windows 10 in just 7 Mb and run your first C++…

5 years ago

PHP .HTACCESS Redirects

We can redirect any webpage to any other or redirect the whole domain or website…

5 years ago

PHP Redirect Pages

There are lots of methods to redirect pages, like refresh-redirect from META tag, redirect from…

5 years ago

PHP Include & Required

Include files in PHP are used in appending various global or config files. We can…

5 years ago