Created
April 12, 2016 15:21
-
-
Save gregrickaby/a15422be00e46e3ec5532f9bdd9ed484 to your computer and use it in GitHub Desktop.
Customize the 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 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