Get my FREE ebook:
"SEO FOR BLOGS: The Ultimate Guide"
Limited Time Offer!

How To Remove “Private” And “Protected” From Your WordPress Blog Post Titles

Whenever you publish a post and set it to being Private or Password-Protected, WordPress will automatically prepend “Private:” or “Protected:” to your WordPress blog post title.

However, if you want to keep your post titles clean, all you need to do is paste the following piece of code in your functions.php file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function the_title_trim($title) {
	$title = attribute_escape($title);
	$findthese = array(
		'#Protected:#',
		'#Private:#'
	);
	$replacewith = array(
		'', // What to replace "Protected:" with

		'' // What to replace "Private:" with

	);
	$title = preg_replace($findthese, $replacewith, $title);
	return $title;
}
add_filter('the_title', 'the_title_trim');

Once the code is pasted in fuctions.php, simply save the file and it will be activated automatically.

Commenting Contest
If you enjoyed this article, Get email updates
(It's Free)
Sté Kerwer
Post written by: Sté Kerwer
Bonjour from France. My name is Stéphane Kerwer and Dukeo.com is my blog. I do most of the heavy lifting in here but from time to time, you may see some guest posts. If you wish to receive updates about Dukeo, subscribe to RSS Feed, follow Dukeo on twitter or become a fan on Facebook.
Comments are closed.
Comments on this post are currently closed.
arrow