Support » Fixing WordPress » Change password protect text in a child theme?

  • I’d like to change the text on password protected posts. The thread here seems to cover the technical details (I guess it works on WP 3.5+) but I don’t want to change my theme’s function.php file. I would rather do it in my child theme, but it has no function.php file and not sure how to use the code in the linked thread to a new file and have it work properly.

    Thanks for any assistance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • “Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)”


    That is simple to do, and I will be at my other machine in the morning where I can post the few lines needed if you do not have it done by then.

    Here is all I needed to add to functions.php inside my Twenty Twelve Child Theme:

    // change password message for protected page/s
    function change_pw_text($content) {
    $content = str_replace(
    'This post is password protected. To view it please enter your password below:',
    'Hint: Tell our system to show you, and it will.',
    return $content;

    Thanks. That code worked. I didn’t have a function.php file so created one. I added:


    to the top to get it to work but in the regular function.php file, I didn’t see a closing tag. Is there one for the <?php tag?

    I don’t believe a closing tag is required.

    … and if you might ever use one anyway, be sure to never have any spaces or line breaks after the close.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change password protect text in a child theme?’ is closed to new replies.