Today I was overjoyed to stumble across a new filter in the function that gets the archive title in WordPress: get_the_archive_title(). This filter allows you to easily change the word/prefix “Arhives: ” to whatever you want or to NOTHING.
I generally was never a fan of the prefixed text: “Archives: ” and “Category: ” coming before the post type name or the taxonomy term. I suppose it is WordPress’s way of letting you know where you’re at, but if the site is designed correctly and breadcrumbs are used, it’s sort of unnecessary. Plus, the word “Archive” sounds like its something old. Many times events are upcoming, and they are in the archives. Go figure.
It used to be sort of a hack and a PITA to make this text go away, often using something that looked like this:
add_filter( 'get_the_archive_title', function( $title ) {
$title = str_replace( 'Archives: ', '', $title );
}, 10, 1);
But now, this is all you need:
add_filter( 'get_the_archive_title_prefix', '__return_false' );
SPLENDID.