WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Change default text in a password protected page?

[Resolved] Change default text in a password protected page?

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

    @esmi

    Forum Moderator

    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

    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

    Forum Moderator

    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 ‘[Resolved] Change default text in a password protected page?’ is closed to new replies.