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):
PHP:
function remove_private_prefix($title) {
$title = str_replace(
'Private:',
'',
$title);
return $title;
}
add_filter('the_title','remove_private_prefix');
$title = str_replace(
'Private:',
'',
$title);
return $title;
}
add_filter('the_title','remove_private_prefix');
(I also posted this filter in the WordPress Support Forum)
Comments/Pingbacks/Trackbacks
Add a Comment or trackback from your own site.
C. Tyson Edwards
August 18th, 2008 at 4:27 pmThis is great. Thank you.