I'm building a WordPress website using the Patch theme. On my category pages, I have:


text as the archive page title and I would like to change it to a custom text for each category. I have searched in Stackexchange but there doesn't seem to be a solution to this. People mostly ask for the category page title in the head section of the HTML.

One of the solutions I found was this:

function my_change_category_title( $title, $sep ) {
    if ( is_category('life') ) {
        return 'Life is life';

    return $title;

add_filter( 'wp_title', 'my_change_category_title', 10, 2 );

Where "Life is life" is supposed to replace the current "Category: Life" title that I have. But this doesn't work.

Here is my archive.php file, which I plan to use for my category-slug.php template files:

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly

get_header(); ?>

<?php if ( have_posts() ) : ?>

    <div id="primary" class="content-area">
        <main id="main" class="site-main" role="main">

            <?php get_template_part( 'loop' ); ?>

            <?php patch_paging_nav(); ?>

        </main><!-- #main -->
    </div><!-- #primary -->

<?php else : ?>

    <?php get_template_part( 'content', 'none' ); ?>

<?php endif; ?>

<?php get_footer();

That is the only change I would have to make to the code of the theme, so I would be very grateful if someone can assist me with this.

  • Wouldn't it be easier to just change the category name to what you're looking for? You could keep the slug the same and overwrite it whenever adding it to menus.
    – Howdy_McGee
    Nov 25, 2020 at 23:13
  • Well, I guess I could do that. However, I would still have to get rid of the "Category:" part in the page title. Also, the Category is not printed in the archive.php file, so I cannot override it like this in my category-slug.php template file. I will edit the post to show the archive.php file of the theme. Nov 29, 2020 at 10:24

1 Answer 1


Not the best solution, but still works for my needs.

I used the category description instead, with h1 tags so that it looks like a heading. Then removed the taxonomy page title with:

function my_theme_archive_title( $title ) {

    return "";

add_filter( 'get_the_archive_title', 'my_theme_archive_title' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.