Remove Archive labels from Archive title in WordPress
Welcome to TechSolutionsHere. Today’s post is about removing Archive labels from Archive title in WordPress. Let’s get started…
To do this you can use a filter following the below and put it in a file functions.php
add_filter( 'get_the_archive_title', 'my_theme_archive_title' ); /** * Remove archive labels. * */ function my_theme_archive_title( $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_post_type_archive() ) { $title = post_type_archive_title( '', false ); } elseif ( is_tax() ) { $title = single_term_title( '', false ); } elseif ( is_home() ) { $title = single_post_title( '', false ); } return $title; }
That’s it. Hope this is helpful to you
Happy Coding! Thanks