Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I was just testing the password-protected posts functionality and when I submit the password it sends me to a 404 page. The password I typed in was correct, I made sure. The URL bar says: www.mydomain.com/wp-pass.php but shows a 404 page. Whether the password is correct or wrong, it should either show some message about it being wrong or the post that was protected. Not just a 404 page.

What could be causing this? Thanks in advance for any ideas.

share|improve this question
    
Does your browser send a Referer header? –  toscho Dec 6 '12 at 11:20
    
I'm afraid I don't know what you mean. Could you explain? –  charlenemasters Dec 6 '12 at 11:39
    
See wp-pass.php: wp_safe_redirect(wp_get_referer()); If your browser does not send a Referer you might get problems. Your browser offers a debugger where you can see the network communication. –  toscho Dec 6 '12 at 11:54
    
So this is something specific to the browser that is being used to view the website and not Wordpress itself? I use Firefox 17, but I also tested it in Chrome 23 and I'm getting the same error. –  charlenemasters Dec 6 '12 at 14:24
    
Some proxies are stripping the referer too, no matter what browser you are using. I don’t know if that is the cause for your problem. It could be. –  toscho Dec 6 '12 at 14:31

3 Answers 3

Ok, figured it out myself! I had used add_filter to customize the password form in order to add css classes. Everything in add_filter was either old or simply wrong. I found it in a tutorial, but this has been a lesson to me. Never trust code found on the web unless it from the Codex or an absolute expert.

EDIT: Just found the same piece of code in the Codex as well *facepalm. It says "THIS NO LONGER WORKS" above it, but then why is it still in the codex? To anyone having this problem as well: in case you have used the code from here: Using Password Protection: Password Form Text you'll get problems in newer versions of Wordpress.

share|improve this answer

mfw when the right answer from Wombat has -3

Sorry for not commenting but I don't have any repo here yet and am really just wondering what's going on on wordpress.stackexchange.com

What exactly should Wombat add to this? We have a WP installation with some old code (meanwhile codex should be correct for the current WP version) from codex.wordpress.com in our Theme's functions.php file to customize the password form for example like this:

<?php
function my_password_form() {
    global $post;
    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
    $o = '<form action="' . esc_url( site_url( 'wp-pass.php', 'login_post' ) ) . '" method="post">
    ' . __( "To view this protected post, enter the password below:" ) . '
    <label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" maxlength="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
    </form>
    ';
    return $o;
}
add_filter( 'the_password_form', 'my_password_form' );
?>

On some update WP changed the form but as we overwrite it with our filter in our functions.php we now get the error described by the OP after the update in question. And now we change wp-pass.php to /wp-login.php?action=postpass just like Wombat said (and like shown on the current codex page) like this:

<?php
function my_password_form() {
    global $post;
    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
    $o = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
    ' . __( "To view this protected post, enter the password below:" ) . '
    <label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" maxlength="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
    </form>
    ';
    return $o;
}
add_filter( 'the_password_form', 'my_password_form' );
?>

Problem solved. (For anyone who already implemented a custom filter which caused this problem this should be no problem with the information Wombat provided... so why the heck do you guys down rate him??)

share|improve this answer
    
Welcome on WPSE Jey. The problem is that he isn't adding any explanation, context and alike. Please have a look at wordpress.stackexchange.com/help/how-to-answer –  kraftner Jul 31 at 12:13
    
I kinda know the rules for answers. But it's not helpful at all when due to 'bureaucracy', if you will, a correct answer gets down rated. I was here because I had the problem with an old WP site which got updated recently and as the post(s) of charlenemasters and its comments were not very helpful I had to figure out on my own what the problem was (I didn't read Wombat because of the -3). And when I found the problem I had the feeling I have seen the solution before, came back here and read Wombat; doing so in the first place would have saved me some time - and maybe other googlers, too... –  Jey DWork Jul 31 at 12:27

Change the instance of wp-pass.php to /wp-login.php?action=postpass

share|improve this answer
1  
Please add more detail to this answer. –  s_ha_dum Mar 22 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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