How to remove “Category:” in title from category pages

By default, the category pages display title in format “Category: Category Title”. Showing “Category:” in title is redundant and is not beautiful. To remove “Category:” from the title, you need to add some code to your theme. This post is about to do that.

The problem of the category title

Here is the screenshot of the category title in TwentySeventeen theme (the default WordPress theme):

Category title in 2017 theme
Category title in 2017 theme

If you’re on the category page, it’s better to show only the category title (without the word “Category:”) or a breadcrumb like Home → Travel. That provide a clear information to users to show where they are. You can see a good example of removing category title in our recent theme Floral. Keeping everything short and clear is always better.

How to remove “Category:” from category title

It’s easy to do that. Simply open the functions.php file in your theme and add the following code at the end of the file:

function prefix_category_title( $title ) {
    if ( is_category() ) {
        $title = single_cat_title( '', false );
    }
    return $title;
}
add_filter( 'get_the_archive_title', 'prefix_category_title' );

Now refresh your category pages and you will see “Category: ” is gone.

If the theme you’re using is a premium WordPress theme, you shouldn’t edit the functions.php file directly. Because you will loose all the edits when it’s updated. Instead of that, you should use a child theme to do the job. To create a child theme, please follow this guide.

After creating the child theme, put the code above in the functions.php file. It works similarly. And you never loose the change when the theme is updated.

24 thoughts on “How to remove “Category:” in title from category pages

  1. It doesnt work. I have a Child Theme and i put the code in functions.php. But you can still see the Name “Katagorie-Archive: Archiv”. Pleas help!

  2. Hi,

    Please HELP! I put the code in and my site is gone after refreshing. Here is the error message:

    This page isn’t working

    suamelatotnhat.com is currently unable to handle this request.
    HTTP ERROR 500

    What should I do now?

  3. Hi Hoa,

    Can you take a screenshot of your functions.php file? I guess you put it before the opening PHP tag. If so, please try to copy and paste the code below the

  4. Hi Anh,

    My site has totally crashed now. I can’t go back into it any more. All I have now is the error message:

    This page isn’t working

    suamelatotnhat.com is currently unable to handle this request.
    HTTP ERROR 500

    I put the code at the very end of my functions.php file.

    Is there anything I can to get my site back?

    Thanks,

  5. my theme does not have a function.php file in the WP admin view. It does have a space for custom CSS codes. can you help?

    1. You probably is using a child theme. In this case, you still can create a file functions.php in your child theme and add the code in the article.

    1. Hi Eddie, probably the theme outputs the title in a different way. You need some coder to help you resolve this.

  6. Worked like magic. Thank you for such a simple solution! As a novice struggling to understand JavaScript, the only thing I’d like to see is some explanation of how this magic works.

  7. Thanks a lot ! it worked perfectly for me but I have also a shop in my website using woocommerce, the word “Category” is removed for categories in the blog but it still in the shop categories. Can any one tell me how to remove it?

Leave a Reply