Created
April 12, 2016 17:29
-
-
Save mateusneves/20d5d6fd9d26e1f31ce1fdb989675313 to your computer and use it in GitHub Desktop.
Remove Private/Protected from Post Titles
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
//https://css-tricks.com/snippets/wordpress/remove-privateprotected-from-post-titles/ | |
function the_title_trim($title) { | |
$title = attribute_escape($title); | |
$findthese = array( | |
'#Protected:#', | |
'#Private:#' | |
); | |
$replacewith = array( | |
'', // What to replace "Protected:" with | |
'' // What to replace "Private:" with | |
); | |
$title = preg_replace($findthese, $replacewith, $title); | |
return $title; | |
} | |
add_filter('the_title', 'the_title_trim'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment