Last active
August 29, 2015 14:08
-
-
Save fernandofuly/a46410c24f07e843afce to your computer and use it in GitHub Desktop.
Remove “private” and “protected” from the post 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 | |
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'); | |
?> | |
// Credits: http://digwp.com/2010/02/remove-private-or-protected-from-post-titles/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment