• Resolved lazyym

    (@lazyym)


    Hello, I notice when sharing category pages that the title includes the word archive in link previews. How can I remove this? Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @lazyym
    Use the following code to update the archive title.

        add_filter( 'get_the_archive_title', function ($title) {    
            if ( is_category() ) {    
                    $title = single_cat_title( '', false );    
                } elseif ( is_tag() ) {    
                    $title = single_tag_title( '', false );    
                } elseif ( is_author() ) {    
                    $title = '<span class="vcard">' . get_the_author() . '</span>' ;    
                } elseif ( is_tax() ) { //for custom post types
                    $title = sprintf( __( '%1$s' ), single_term_title( '', false ) );
                } elseif (is_post_type_archive()) {
                    $title = post_type_archive_title( '', false );
                }
            return $title;    
        });
    Thread Starter lazyym

    (@lazyym)

    Thanks,

    The word “Archive” still appears behind the meta title after the category name when this is added to the functions file.

    Hi @lazyym

    It looks like it is coming from the theme side. Our plugin and most of the templates will use the default archive-title filter.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove “Archive” from category page titles?’ is closed to new replies.