Written by me@grafxflow
27 Mar, 2013
2
3,720
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.
11 Nov, 2018
21 Feb, 2021
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!
Follow18 Dec, 2025
20 May, 2025
11 Jul, 2023
Views: 198,142
Views: 197,591
Views: 174,621
Views: 146,009
2 Response