Last active
September 3, 2018 15:33
-
-
Save PurpleHippoDesign/8f07ebf29651d3360e69d2c2b4176a5b to your computer and use it in GitHub Desktop.
Remove archive title prefix from WordPress archive title
This file contains hidden or 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
<?php //<~ Remove me | |
/** | |
* Remove archive title prefixes. | |
* | |
* @param string $title The archive title from get_the_archive_title(); | |
* @return string The cleaned title. | |
*/ | |
function ph_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', 'ph_custom_archive_title' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment