SDAC Blog

Read our latest blog posts, learn something new, find answers, and stay up to date.

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) {
$title = str_replace(
'Private:',
'',
$title);
return $title;
}
add_filter('the_title','remove_private_prefix');

(I also posted this filter in the WordPress Support Forum)