Remove “Private:” From WordPress Titles
I needed to be able filter out the text "Private:" for posts and pages that were password protected but did not want to edit any core WordPress files. To filter out that text, I added the following code into my functions.php file (within my theme directory):
-
function remove_private_prefix($title) {
-
'Private:',
-
'',
-
$title);
-
return $title;
-
}
-
add_filter('the_title','remove_private_prefix');
(I also posted this filter in the WordPress Support Forum)


Thanks
~ Life life fully
seriously, that rocks! =)
Glad it helped out!
I try your script, it works very well, but it replaces every instances on “the_title()” template function.
I’ve replaced
add_filter(‘the_title’,'remove_private_prefix’);
with
apply_filters(‘the_title’,'remove_private_prefix’);
and then replaced only that I’d like to filter with
(take a look to wp-codex for more documentation).
I think it could be more flexible, will you?
Thanks.
Enrico.
Sorry “php” snippets was removed from my comment… I mean
…and then replaced only ” the_title()” I’d like to filter with ” remove_private_prefix(the_title(”,”,false))” …
sorry…
you the man
This worked well,. I had to remove defaulted numbers 1 -7 that somehow found their way into the copy & paste routine,.. and then just pasted it after the defaulted php call in the functions.php before the end ?> bracket and it worked like a charm.
Thanks a lot
Works perfectly. Thanks for sharing.
Thanks! It is perfecto and now I don’t have to explain to folks that it isn’t really private, I just didn’t want it on my pages menu.
Good stuff.
Wow! Thanks so much for that! Worked perfect!
Simple and works. Thanks