WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Password Protect This Post – Change text?

[Resolved] Password Protect This Post – Change text?

  • pameluke
    Member

    @pameluke

    I’d like to change the default text that comes up with password protected posts or pages.

    Currently it reads:

    This post is password protected. To view it please enter your password below:

    I’d like to change this, but I have no idea where I could find this. Anyone?

Viewing 5 replies - 1 through 5 (of 5 total)
  • educationthemes
    Member

    @educationthemes

    I found the solution here:

    http://wordpress.org/support/topic/135584?replies=6

    It was a while ago and probably an older version of WordPress but it may work. Give it a try.

    Its not great though because it is a core files hack which is not a great solution.

    Dagon Design
    Member

    @dagon-design

    For WordPress 2.0-2.1, /wp-includes/template-functions-post.php

    For WordPress 2.2+, /wp-includes/post-template.php

    You will find the text in that file. 🙂

    pameluke
    Member

    @pameluke

    Works like a charm! Thanks a lot!

    It’s line 1140 in wp-includes/post-template.php

    Version 2.8

    garethooper
    Member

    @garethooper

    Add the following to your Funtions.php file under your theme folder:

    // Password Protected Page Message
    function custom_password_form($form) {
      $subs = array(
        '#<p>This post is password protected. To view it please enter your password below:</p>#' => '<p>Change this for New Message.</p>',
        '#<form(.*?)>#' => '<form$1 class="passwordform">',
        '#<input(.*?)type="password"(.*?) />#' => '<input$1type="password"$2 class="text" />',
        '#<input(.*?)type="submit"(.*?) />#' => '<input$1type="submit"$2 class="button" />'
      );
    
      echo preg_replace(array_keys($subs), array_values($subs), $form);
    }
    
    add_filter('the_password_form', 'custom_password_form');
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Password Protect This Post – Change text?’ is closed to new replies.