WP-Mix

A fresh mix of code snippets and tutorials

Remove ‘Private’ from private post titles

By default, WordPress prepends the string “Private: ” to all posts marked as “private”. Here’s a quick function to remove the private prefix and move on with your life.

// remove "Private: " from titles
function remove_private_prefix($title) {
	$title = str_replace('Private: ', '', $title);
	return $title;
}
add_filter('the_title', 'remove_private_prefix');

Just add that code snippet to your theme’s functions.php file and you’re good to go.

Learn more

WordPress Themes In Depth