Code Snippets Gallery
Remove Private/Protected from Post Titles
For the functions.php file in your theme:
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');
Or you do it like that:
function title_format($content) {return '%s';
}
add_filter('private_title_format', 'title_format');
add_filter('protected_title_format', 'title_format');
Thanks man!
Thank you so much! This was bothering me on a client site I am developing.