Remove Archive:, Category:, Tag:, Author: From The Before Archive Title

In WordPress Archive:, Category:, Tag:, Author: before archive title is the default one. These taxonomy shows based on which you selected and that show relevant taxonomy name (e.g Category: WordPress). If you like to remove before WordPress name Category: then you need to use some functions to remove from the page.
Using functions.php you can remove all the Taxonomy name which shows before the the_archive_title. Use the below code to remove Archive:, Category:, Tag:, Author: from all the pages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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() ) { // Custom Post Types $title = sprintf( __( '%1$s' ), single_term_title( '', false ) ); } elseif (is_post_type_archive()) { $title = post_type_archive_title( '', false ); } return $title; }); |
Remove ‘Category:’ In The Before Archive Title Custom
If you like to remove the ‘Category:’ in the before archive title with custom code, then use the below code in your archive.php or duplicate archive.php template and rename as a category.php and use the code.
If you want to know more about creating Custom Template for the Category then here you have an article.
1 |
<h1><?php echo single_cat_title(); ?></h1> |
Conclusion:
I hope this will help you to remove Archive:, Category:, Tag:, Author: before archive title. Also, the custom code is simplified to solve the issue in an easy way. If you have any queries about this article use the comment box to let me know and if you really love this share it with your friends.
Custom PostRemove ArchiveWithout Pluginwordpress
Mraj
Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts. If you have any questions let me drop an email with the article name to the following email id: [email protected]