Support » Fixing WordPress » How to remove “Protected” from pw protected page titles

  • Resolved syncbox


    When you password protect a page in 2.8.5 and the user enters the password, the title changes to prepend “Protected:” to the actual title.

    How do you stop that behavior? Help appreciated!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Nevermind, found my own answer (again).

    It’s in the “get_the_title() functions in the post-template.php file in wp-includes, line 113 in version 2.8.5

    $protected_title_format = apply_filters(‘protected_title_format’, __(‘Protected: %s’));

    But doesn’t it get reset every time you update WordPress?

    I saw a fix for something else where you added code to the functions.php file in your theme so this doesn’t happen. Anyone know what that code might be?

    Hi. The information on states:

    The only thing you have to do is to paste the following piece of code in your functions.php file. Once you’ll save the file, the hack will be applied to your your posts.

    function the_title_trim($title) {
    	$title = attribute_escape($title);
    	$findthese = array(
    	$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');

    I am not understanding where to put the add_filter(‘the_title’, ‘the_title_trim’);

    Copying and pasting throws an error on my site, but when I remove that last line, the error is not thrown, but the “Protected” is still visible, so it obviously needs to be included.

    Any insight on this is greatly appreciated.


    I posted the above code at the very top of my functions.php file and it successfully removed “Protected:” from my post titles… but I got a bunch of errors in my backend (in the post/page editors and whatnot). Placing the code elsewhere in my functions file just gave me an error and wouldn’t load my site.

    Solution that worked for me:

    add_filter('protected_title_format', 'blank');
    function blank($title) {
           return '%s';

    Copy and paste that code snippet at the top of your functions file… (after <?php )

    Hope that helps!

    Thanks stacybird! That did it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to remove “Protected” from pw protected page titles’ is closed to new replies.