If you are a WordPress developer or WordPress website owner. And looking for ways to completely remove “Archive:”, “Category:”, “Tag:”, “Author:” from the_archive_title in WordPress then you must need to read this article.
In this article, you will get complete steps to make it possible for you. By default, WordPress displays “Archive:”, “Category:”, “Tag:”, “Author:” in the_archive_title.
Suggested Read: How To Disable (or Remove) “All Posts, Published, and Trash” in Dashboard Posts
Before starting the process, you just need to create a child theme of your current theme. So that you will not lose your updated code after the main theme updation in the future.
Are you want to get implementation help, or modify or extend the functionality of this script?
A Tutorialswebsite Expert can do it for you.
Remove “Archive:”, “Category:”, “Tag:”, “Author:” from the_archive_title
Now add the following code in the functions.php file of your child theme.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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 =get_the_author(); } 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; }); |
Now open your category or archive page and see the magic of the above code snippet. Please refer below image
Conclusion
Well, In this article you will get the complete steps to Remove “Archive:”, “Category:”, “Tag:”, “Author:” from the_archive_title in WordPress. You can extend the functionality as per your requirement. I hope you found this tutorial helpful for your project. Keep learning!.
Are you want to get implementation help, or modify or extend the functionality of this script? submit your paid request
Pradeep Maurya is the Professional Web Developer & Designer and the Founder of “Tutorials website”. He lives in Delhi and loves to be a self-dependent person. As an owner, he is trying his best to improve this platform day by day. His passion, dedication and quick decision making ability to stand apart from others. He’s an avid blogger and writes on the publications like Dzone, e27.co
[…] Remove "Archive:", "Category:", "Tag:", "Author:" from the_… […]