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.

function the_title_trim($title)
$pattern[0] = ‘/Protected:/’;
$pattern[1] = ‘/Private:/’;
$replacement[0] = ”; // Enter some text to put in place of Protected:
$replacement[1] = ”; // Enter some text to put in place of Private:

return preg_replace($pattern, $replacement, $title);
add_filter(‘the_title’, ‘the_title_trim’);

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


  1. Madeglobal on September 14, 2009 at 7:56 am

    You could also try the plugin “better-protected-pages” available from … hope that helps!

  2. TJM on March 26, 2010 at 1:19 pm

    Unfortunately this doesn’t work in my case. Just get a bunch of parse errors “unexpected ….” on the password protected page. 🙁

Leave a Comment