Skip to Main Content

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.

This article isn’t a long description of how to make custom password forms (that’s on the CODEX), 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 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.

Share the love:

Get Support

Nobody's perfect. If you need a little help, request support from the super-nerds at JDM Digital.

Any information you provide here will be kept confidential and only used for this purpose.

So we can follow-up.

The URL of the issue.

The more specific you can be, the better.

I am 100% robot

You're not a robot, are you? Sorry we have to ask.