Blog ›
27 Mar
2013

Remove the 'Private:' title for private posts
If you are creating private pages or posts for certain members to view, you will notice by default WordPress adds 'Private:' to the title. So the title 'Secret Page/Post' will actually be 'Private: Secret Page/Post'. This is not necessarily what you want the user to see.
So here is the solution:
1. Open the 'functions.php' file that's in your themes folder and add the following code to the end.
function remove_private_prefix($title) {
$title = str_replace(
'Private:',
'',
$title);
return $title;
}
add_filter('the_title','remove_private_prefix');
Now the 'Private:' part of the title should no longer appear.
Posted in: <
CMS
>


me@grafxflow
I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!
Visitors also viewed these posts
2 Thoughts
27 Nov
2016
Dawesi
`/* Removing private prefix from post titles */function spi_remove_private_protected_from_titles( $format ) {
return '%s';
}
add_filter( 'private_title_format', 'spi_remove_private_protected_from_titles' );`
27 Nov
2016
me@grafxflow
Cheers Dawesi for update.