WordPress 3.4 Custom Password Form

Are your password protected posts and pages broken since upgrading to WordPress 3.4?

Here is a little tip for anyone out there who may be using a custom password form to protect individual pages and posts. WordPress has this functionality built into its core but it is possible to customize the wording and look of your form. If you aren’t able to get into password protected posts anymore, you likely have a custom password form.

This post isn’t a long description of how to make custom password forms, rather a helpful tip to fix your password protected posts and pages if they are no longer accessible since upgrading to WordPress 3.4.

The core of the problem is that WordPress 3.4 has deprecated the use of wp-pass.php which was used in many custom password forms and replaced it with wp-login.php. Below is what a custom password form function is likely to look like, at least it’s what mine looks like:

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

The first trick is finding where in your theme files that bit of code might be located. It could be in the functions.php file or  in its own php file somewhere in your theme. Once you find it though, if you replace wp-pass.php with wp-login.php?action=postpass you should fix your problem. At least that’s how I updated my custom themes.

  • Theleisurehour

    This worked for me, thank you VERY much!

    • gsibert

      Glad it helped out!

  • moritz

    thanks a lot. worked pefectly.

    • gsibert

      You’re welcome. Some day, and that day may never come, you will find a fix to some WordPress issue and you will share it with the world too. <– Just watched the Godfather :)

  • Andrew

    Thanks dude. Saved me a LOT of frustration.

  • http://twitter.com/cirilmathew Ciril Mathew

    this works for those who use IE. Its still broken with users using Google Chrome and Firefox

    • gsibert

      I use Chrome, FF, IE, Safari & Opera, they all work… This has nothing to do with browser compatibility, only how WP internally handles passwords.

  • Elton Godschalk

    Saved me a lot of time and frustration! Thanks!

  • Elizabeth

    This worked! Thank you so so much.

  • Trond

    Yes, thanks!!!

  • Evan

    After nearly an hour of Googling I finally found the info that I needed! Thank you SO much!

  • Steve

    At first I thought the problem had something to do with moving the site with backupbuddy. But then after finding your solution, I realized I had updated the website to WordPress 3.4 (after migrating) and yes indeed, the theme had it’s own password form.
    Thank you so much for posting your solution!

    • gsibert

      Glad it helped out, keep on WordPressing!

  • http://www.facebook.com/geza.miklo Géza Mikló

    This change was really a bad idea. All older themes should be revised now.

  • Pingback: Password Protect & Custom Password Form 404 « PixelPress Wiki

  • Roy Kung

    You are my savior. thanks!!!!

  • Jeremy

    Thank You SO MUCH! I had a hunch it was the update, but I had no idea how to fix it until now. You rock! Very helpful :)

  • david

    Thank you very much man, it was really helpful to me and save a lot of time…

  • http://www.facebook.com/sagi.shrieber Sagi Shrieber

    WOW! You saved me!!!! Thanks a lot for this post!

  • Bilbo

    Thank you very much

  • Amy

    This is great advice, my problem is, is that I cannot find where those functions are at all. It’s like the option to password protect my posts is just gone! I have searched and searched, even looking in different themes for any sign of “wp-pass.php” and it is nowhere! I’ve basically created my whole site myself, so I know what I’m doing but I feel like a complete idiot here. Where can I even change “wp-pass.php” ???

    • gsibert

      Did you have this functionality and it just disappeared with a WordPress update? What theme are you using?

  • Pingback: Password Protection Trouble ~ ian-scott.net

  • icapricorn

    Thank you! That fixed my problem. I’m using WordPress 3.5.1

  • goodhand

    AWESOME, saved me working late delving into the core files, legend!