WordPress Tutorial – Remove the Word “Protected:” from Title Text of Password-protected Pages
Remove the word “Protected:” from title text of password-protected pages.
Big thanks to t31os on the WordPress forums. Check out t31os’s site for more WordPress tips.
The following filter function code is placed in the functions.php file, this way it doesn’t accidentally get replaced when WordPress is upgraded.
$pattern = ‘/Protected:/’;
$pattern = ‘/Private:/’;
$replacement = ”; // Enter some text to put in place of Protected:
$replacement = ”; // Enter some text to put in place of Private:
return preg_replace($pattern, $replacement, $title);
NOTE: I had to remove the *<?php* and *?>* tags from the above code and place the function code inside my existing *<?php* and *?>* tags that were already in my functions.php file. Otherwise, it messed up my Multi-level Navigation Plugin for WordPress (which I’m a big fan of).
WordPress version: 2.8.1 RC1
You could also try the plugin “better-protected-pages” available from http://www.wordpress.org/extend … hope that helps!
Unfortunately this doesn’t work in my case. Just get a bunch of parse errors “unexpected ….” on the password protected page. 🙁