When it comes to WordPress, it’s always trial, error, repeat and it can be frustrating when something happens behind the scenes that throw you off.
Here’s the backstory but feel free to just jump below for the code!
After creating a string of blog posts for a client that were not to be accessible through the general “Recent Posts” widgets, we decided to make them private and connect them via page links. This way we could create posts in a customizable orderly fashion, having access to the next one. We could also create a grouping and have access to them all by creating on page links on every blog post so they can go in any order.
But, alas, once posted, we saw a weird thing happen. Every post had “Private:” before each of the titles.
By default, WordPress adds in (prepends) the string “Private: ” to all posts marked as “private”.
Here’s a quick function code to remove the private prefix….. and move on with your life.
Copy this code:
$title = str_replace(‘Private: ‘, ”, $title);
} add_filter(‘the_title’, ‘remove_private_prefix’);
Paste code snippet to your theme’s
functions.php file and you’re good to go!
For more help and resources: