Sunday, July 7, 2013

How to Remove Private/Protected from Post Titles

Here all steps to remove "Private/Protected" text from post titles :

1. click on Appearance -> Editor (Left side menu)
2. click on functions.php file (right side)
3. add this code and save file
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');

Disqus Comments