How can i make "Category:" text disapear?

Hello,

Please help me change the way category archive title is shown on my site. I would like instead of showing Category: Name Here, to only show Name Here - in the header of the category archive.

It has something to do with archive.php code:

<header class=“page-header”>
<?php
the_archive_title( ‘<h4 class=“page-title”>’, ‘</h4>’ );
the_archive_description( ‘<div class=“taxonomy-description”>’, ‘</div>’ );
?>
</header><!-- .page-header -->
Because I noticed when I delete the fields in the <?php …?>, the title disappears altogether. But I don’t want the whole title to go away. Only the designation “Category:” which kind of ruins the whole aspect.

I’m sorry if i’m explaining it badly. I am a complete beginner at wordpress. Thank you a lot if you could guide me to an easy solution. I have searched the web up and down, but all solutions are personalized for other themes and I don’t know what to do. I hope there is an easy way. Thanks in advance !

Hello there,

You cannot delete mentioned lines in order to remove category text. In order to achieve this, add following code at the end of functions.php file:

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

Note that after theme updates, changes will be lost, and in order to make them permanent, you should create child theme https://codex.wordpress.org/Child_Themes and to add that code from child theme functions.php file.

All the Best!

Thank you loads for the info!! This worked like a charm. Have a beautiful day!

You’re welcome,

And thank you for using our theme.

All the Best!

Hi, all. This worked great, but now the “description” has disappeared from the category page.

Suggestions on how to fix?

Thanks!
Matt

@Matt Schulz

Hello there,

Please create your own ticket when topics are resolved. And share your site link so we can inspect this on your end, thanks.

Best Regards!