Skip to content

Instantly share code, notes, and snippets.

@mateusneves
Created April 12, 2016 17:29
Show Gist options
  • Save mateusneves/20d5d6fd9d26e1f31ce1fdb989675313 to your computer and use it in GitHub Desktop.
Save mateusneves/20d5d6fd9d26e1f31ce1fdb989675313 to your computer and use it in GitHub Desktop.
Remove Private/Protected from Post Titles
//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