Remove Private/Protected from Post Title
<?php
function the_title_trim($title) {
$title = attribute_escape($title);
$findthese = array(
'#Protected: #', // Notice the blank space after Protected:
'#Private: #' // Notice again, otherwise the title get pushed.
);
$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');
?>
Instructions:
This snippet removes the description before the post title when a post’s visibility is either Password protected or Private.
If your language is not english, you should replace Protected & Private (as seen in the code below), with the correspondent words in the language you are using.