I would like to create or modify the form of password protected pages. My problem is that: I need another input from the user. If the user gives the email and the password then he/she can see the protected post.

But I do not know how I should start it. Because I think... I have to rewrite the all password protected functionality, in order to handle the one plus input (the email) next to the password input (which is serviced by the WordPress automaticly)

I found this link: http://codex.wordpress.org/Using_Password_Protection . But here the article does not speak about the plus input fields, how I can add or not to the form.

1 Answer 1


For starters, you can hook into the password form. Then you can customize it. Something like:

add_filter( 'the_password_form', 'custom_password_form' );
function custom_password_form() {
global $post;
$o = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
' . __( "This post is password protected. To view it please enter your password below: or add custom message" ) . '
<label for="Email">' . __( "Email:" ) . ' </label><input name="Email" type="text" size="20" required />
<label for="password">' . __( "Password:" ) . ' </label><input name="post_password" id="password" type="password" size="20" required/>
<input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
return $o;

This form will replace the existing password protected form, although I'm sure you can add an if statement for conditional use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.