• Resolved pameluke

    (@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)
  • I found the solution here:

    https://www.ads-software.com/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.

    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. ??

    Thread Starter pameluke

    (@pameluke)

    Works like a charm! Thanks a lot!

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

    Version 2.8

    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 ‘Password Protect This Post – Change text?’ is closed to new replies.