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.
@konstantin
That’ perfect. Very clean and simple and, most importantly, worked like a charm!
Worked perfectly, thanks!
WordPress 3.3: incorrect.
There is no such function in functions.php.
Instead, go to post-template.php and in the function called get_the_title() change this line:
$protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));
Works great thanks!
[Wordpress 3.3.2]
You can also use the WordPress Helpers plugin.
How do you use the WordPress Helpers plugin to accomplish this? Can you give more detail?