Created
March 2, 2020 13:50
-
-
Save itsjusteileen/cc0dcc5eabdb50515c45ee55bea290d5 to your computer and use it in GitHub Desktop.
Removing Archive Title from Theme Archive Header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this snippet to your child theme functions.php file