Remove "Category:", "Tag:", "Author:" from the_archive_title - WordPress

In one of our recent WordPress project, client ask to remove the prefixes like, “Category:”, “Tag:”, “Author:”, etc from archive titles. Below, you can find a small code snippet that will do this job.

function twem_custom_archive_title( $title ) {
	// Remove any HTML, words, digits, and spaces before the title.
	return preg_replace( '#^[\w\d\s]+:\s*#', '', strip_tags( $title ) );
add_filter( 'get_the_archive_title', 'twem_custom_archive_title' );

Need Help?

Do you need any help on WordPress? I'm happy to help you.

Contact Me

Recent Posts

  1. Update query order - WordPress
  2. Display featured products - WooCommerce
  3. The essential & basic WP-CLI commands for a WordPress developer
  4. Install theme unit test data using WP-CLI - WordPress
  5. A basic Samba server on Ubuntu

Questions / Comments

If you found this article interesting, found errors, or just want to discuss about them, please get in touch.