Written by me@grafxflow
27 Mar, 2013
2
3,815
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
Darth Maul and Micro-Organisms: Inside George Lucas's Cancelled Star Wars Sequel Trilogy
How to Automatically Convert DVD Subtitles to SRT on Mac
The $4 Billion Divorce: Inside the Awkward, Painful Sale of Lucasfilm to Disney
The Rift That Broke the Whip: Inside Lucas, Spielberg, and Harrison Ford's 'Furious Rows' Over Indiana Jones
Breaking the Endless Loop: Why Star Wars Needs an Origin Story
Founder, 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. I build lighting-fast dynamic content engines with Laravel, Winter CMS and Tailwind CSS. Thanks for stopping by!
Dawesi
27 Nov 2016
/* 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' );
me@grafxflow
27 Nov 2016
Cheers Dawesi for update.