Whenever you publish a post and set it to being Private or Password-Protected, WordPress will automatically prepend “Private:” or “Protected:” to your WordPress blog post title.
However, if you want to keep your post titles clean, all you need to do is paste the following piece of code in your functions.php file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
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');Once the code is pasted in fuctions.php, simply save the file and it will be activated automatically.

