WordPress tutorials: Remove private and Protected

Wpsnipp – Remove private and Protected.Each time you define a specific post as being private or password-protected, WordPress automatically add “Private” or “Protected” to your blog post title. If you don’t want it, nothing simpler: Just apply this great hack.Adding this PHP code to the functions.php of your wordpress theme will remove the private and protected text that will displayed with password protected posts.

 

 

 

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');

Leave a comment