Skip to content

Instantly share code, notes, and snippets.

@itsjusteileen
Created March 2, 2020 13:50
Show Gist options
  • Save itsjusteileen/cc0dcc5eabdb50515c45ee55bea290d5 to your computer and use it in GitHub Desktop.
Save itsjusteileen/cc0dcc5eabdb50515c45ee55bea290d5 to your computer and use it in GitHub Desktop.
Removing Archive Title from Theme Archive Header
/**
* Remove archive title prefixes.
*
* @param string $title The archive title from get_the_archive_title();
* @return string The cleaned title.
*/
function 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', 'custom_archive_title' );
@itsjusteileen
Copy link
Author

Add this snippet to your child theme functions.php file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment