Skip to content

Instantly share code, notes, and snippets.

@simonwhatley
Created November 8, 2012 09:31
Show Gist options
  • Save simonwhatley/4037758 to your computer and use it in GitHub Desktop.
Save simonwhatley/4037758 to your computer and use it in GitHub Desktop.
Remove Private: and Protected: from the_title() in WordPress
function the_title_trim( $title ) {
$pattern[0] = '/Protected:/';
$pattern[1] = '/Private:/';
$replacement[0] = ''; // Enter some text to put in place of Protected:
$replacement[1] = ''; // Enter some text to put in place of Private:
return preg_replace($pattern, $replacement, $title);
}
add_filter('the_title', 'the_title_trim');
@simonwhatley
Copy link
Author

@retlehs thanks for the heads-up. That's a useful alternative.

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