• Resolved dtlyme

    (@dtlyme)


    Hi – I just would like to customize the default text that shows when a page is password protected:
    Password Protected Page

    Where and how would I do that?

    many thanks-

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi

    (@esmi)

    Try adding something like:

    function my_password_form() {
    	global $post;
    	$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
    	$output = '<div class="password-form">
    	<p class="protected-text">' . __('This post is password protected. To view it, please enter your password below:') . '</p>
    	<form action="' . get_option('siteurl') . '/wp-pass.php" method="post">
    	<p><label for="' . $label . '">' . __('Password:') . ' </label> <input name="post_password" id="' . $label . '" type="password" size="20" /> <input type="submit" name="submit" value="' . esc_attr__('Submit') . '" /></p></form></div>';
    	return $output;
    }
    add_filter('the_password_form','my_password_form');

    to your theme’s functions.php file

    Thread Starter dtlyme

    (@dtlyme)

    As always thank you Esmi. You are a great teacher and that worked beautifully! I made a ‘custom-functions.php’ and used your code. Perfection!

    esmi

    (@esmi)

    Glad I could help 🙂

    The form action points to a wp-pass.php file which does not exist in current versions of WordPress.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change default text in a password protected page?’ is closed to new replies.