Create a gist now

Instantly share code, notes, and snippets.

Customize the WordPress Archive Title
<?php
/**
* Remove archive title prefixes.
*
* @param string $title The archive title from get_the_archive_title();
* @return string The cleaned title.
*/
function grd_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', 'grd_custom_archive_title' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment