How to remove the word "Category:" from page header

Hello,

My client’s website has category pages. Each page shows a page header which looks like below

<header class="page-header">
<h3 class="archive-title">Category: Work</h3></header>

I’m trying to remove the word “Category:” from the page header.

How can I do that?

Thanks

Hello there,

It can be achieved by adding the below function into your child theme’s functions.php file or you can use the My Custom Functions plugin without a child theme.


add_filter('get_the_archive_title', 'sydney_child_archive_title');
function sydney_child_archive_title(){

	if( is_category() ) {
	   $title = single_cat_title( '', false );
	}

	return $title;

}

Regards,
Kharis

Great! This works.

Thanks!

Hello there,

Thank you for updating me. Glad to know it works.

You’re welcome and best wishes!

Kharis,
I’ve tried inserting the code above in my functions.php file and also through the My Custom Functions plug in. In both cases the page title that reads Archives: Publications (I created this category) disappears when I insert the code that you provided.

Is there an update?

When I view the source code, I see the following:

<header class=“page-header”>
<h3 class=“archive-title”>Archives: Publications</h3> </header>

Thank you.

Hello there,

If your site is cached, be sure you clear it. Otherwise, the changes won’t take affect.

If it’s still disappear, please share the link to your post archive page, so I can have a look.

Regards,
Kharis