In WordPress, you can set the visibility of any single post or page to password-protected. Many themes will even come with a custom password protected message/form. That cool feature can cause issues after WordPress version 3.4, but there IS a fix.
WordPress has this functionality built into its core but some themes customize the wording and look of your form via the theme’s functions.php
file. If you aren’t able to get into password protected posts anymore, you likely have a custom password form than needs some love.
The Problem
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?action=postpass
.
Below is what a custom password form function is likely to look like:
/* Custom Password Protected page */ add_filter( 'the_password_form', 'my_password_form' ); function my_password_form() { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $o = '<form action="' . get_option('siteurl') . '/wp-pass.php" method="post"> ' . __( "<p>Please enter the password</p><br />" ) . ' <label for="'.$label.'">'. __("<b>Password</b>:").'</label> <input name="post_password" id="' . $label . '" type="password" size="20" /> <input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" /> </form> <p><small><a href="'.get_option('siteurl').'/contact/">contact us</a></small><p>'; return $o; } /* custom password END */
The Fix
So, since there isn’t a wp-pass.php
file in the WordPress core anymore, you’ll probably get a 404 page not found error.
All you have to do is change wp-pass.php
in that function to wp-login.php?action=postpass
and upload/replace.
Works like a charm. A special thanks to Tummel.me for the handy post.