Override category archive page title (not the head title)


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.

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.

Todor Atanasov 2 months 0 Answers 8 views 0

Leave an answer