WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Password Protect This Post - Change text? (6 posts)

  1. pameluke
    Member
    Posted 5 years ago #

    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?

  2. educationthemes
    Member
    Posted 5 years ago #

    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.

  3. Dagon Design
    Member
    Posted 5 years ago #

    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. :)

  4. pameluke
    Member
    Posted 5 years ago #

    Works like a charm! Thanks a lot!

  5. kaylee
    Member
    Posted 5 years ago #

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

    Version 2.8

  6. garethooper
    Member
    Posted 5 years ago #

    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');

Topic Closed

This topic has been closed to new replies.

About this Topic