Skip to content

Instantly share code, notes, and snippets.

@fernandofuly
Last active August 29, 2015 14:08
Show Gist options
  • Save fernandofuly/a46410c24f07e843afce to your computer and use it in GitHub Desktop.
Save fernandofuly/a46410c24f07e843afce to your computer and use it in GitHub Desktop.
Remove “private” and “protected” from the post title
<?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