Site logo

Archived topic

How to remove category archive title (but keep the category description)

3 replies · Started by Al on June 3, 2022

Viewing posts 1–4 of 4

Hello!
I need to remove the default title from Category archives. I tried the snippet on this forum post: https://generatepress.com/forums/topic/remove-the-title-on-category-archive-pages/

add_action( 'after_setup_theme', function() {
remove_action( 'generate_archive_title', 'generate_archive_title' );
} );

The suggested snippet works great for removing the title – but it also removes the category description along with it, which I need to keep. Is there a way to remove only the title, without having to hide it via CSS?

Secondarily, is it possible to have it only apply to the category archives and not date or author-based archives? That's not mission-critical, but would be nice.

Thanks!

Hi there,

try this PHP Snippet:

add_action('wp', function(){
    if ( is_category() ) {
        remove_action( 'generate_archive_title', 'generate_archive_title' );
        add_action( 'generate_archive_title', 'generate_do_archive_description' );
    }
});

Hm, I could have sworn I replied to this, but I guess not. Thank you, David! That snippet worked great.

Glad to hear that!

This archived topic is closed to new replies.