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.
This worked for me, thank you VERY much!
Glad it helped out!
thanks a lot. worked pefectly.
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 🙂
Thanks dude. Saved me a LOT of frustration.
this works for those who use IE. Its still broken with users using Google Chrome and Firefox
I use Chrome, FF, IE, Safari & Opera, they all work… This has nothing to do with browser compatibility, only how WP internally handles passwords.
Saved me a lot of time and frustration! Thanks!
This worked! Thank you so so much.
Yes, thanks!!!
After nearly an hour of Googling I finally found the info that I needed! Thank you SO much!
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!
Glad it helped out, keep on WordPressing!
This change was really a bad idea. All older themes should be revised now.
You are my savior. thanks!!!!
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 🙂
Thank you very much man, it was really helpful to me and save a lot of time…
WOW! You saved me!!!! Thanks a lot for this post!
Thank you very much
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” ???
Did you have this functionality and it just disappeared with a WordPress update? What theme are you using?
I found it in root/wp-content/themes/XXX/includes
Thank you! That fixed my problem. I’m using WordPress 3.5.1
AWESOME, saved me working late delving into the core files, legend!
Thank you!!
Thanks! This helped a LOT. 🙂
Thanks for the post. To get it to work for WP Version 3.5.2 you need to change
/wp-pass.php action=postpass
To
/wp-login.php?action=postpass
Worked for me
Finally! Thankyou!
i found functions.php file but could not find wp-pass.php , where is it?? help me
thanks
Hi Rano, you’re not actually looking for the file wp-pass.php but a reference to it. Probably the easiest way to find it in your theme is to download the theme directory to your local computer (if you don’t have it there already) and search the theme folder for wp-pass.php. That should give you a list of files that contain that text… at least that’s how I would look for it. Strange though, this is a rather old problem. How long has it been since you updated WordPress?
THANK YOU! This was the solution I was looking for!
Wow, 8 years later and still helpful. So glad to hear 🙂