• I have a site with a page that has a “members” section password protected. For some reason, within the last week or two, when users try to login with the password they’re presented with a blank page which has the url of – “/wp-login.php?action=postpass”

    The weird thing is that when I login on all my computers (PC & Mac) and phones it works flawlessly by redirecting back to the /members/ page and logged in. But some people have it work in some browsers and not others, and some don’t work in browsers that work for me.

    After researching this for days, I’ve seen a couple potential reasons like HTTPS to HTTP redirect and needing a referrer URL. I’ve added a line of code that’s supposed to pass the referring URL..

    <input type="hidden" name="_wp_http_referer" value="'.get_permalink().'" />

    The site is SSL, and has https in the WP settings, and I even have a force SSL plugin to ensure constant HTTPS.. I’ve had people clear cache and cookies, and frustratingly, some people still have this issue. I’m at a loss.. Anybody have this issue and/or know how to resolve it/what’s causing it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try to add the following code in your theme’s functions.php

    function dcg_password_form_fix() {
        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 the contents of this page, 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', 'dcg_password_form_fix' );
    Thread Starter itsthenewdc

    (@itsthenewdc)

    Sorry for not mentioning it in full earlier, but this is the code I already had:

    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 post-password-form" action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post">'.
        __( "Password-protected area." ).
       '<div class="col-md-2 col-md-offset-5">
       <input name="post_password" class="form-control" id="' . $label . '" type="password" style="font-size:22px; border-radius:.5rem; text-align:center;" />
       <br />
       <input type="submit" name="Submit" class="btn btn-block" style="font-weight:bold;" value="'. esc_attr__( "Login" ).'" />
       </div>
       <input type="hidden" name="_wp_http_referer" value="'.get_permalink().'" />
       </form>';
       return $o;
    }
    • This reply was modified 7 years, 10 months ago by itsthenewdc.
    • This reply was modified 7 years, 10 months ago by itsthenewdc.
    • This reply was modified 7 years, 10 months ago by itsthenewdc.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Password Protected Page Not Redirecting for Some Users’ is closed to new replies.