Support » Fixing WordPress » Password protection not working since update

  • Hi there,

    Since I updated to the latest version of WordPress, the password protect feature seems to be broken.

    When the user types in the password to access the hidden content, he gets redirected a page to prove he is not a bot, and then he gets redirected to https://website/wp-login.php?action=postpass which is a blank page.

    I have tried this feature on several of my WordPress websites and they all cause this error.

    Therefore it leads me to believe it is a general problem?

Viewing 4 replies - 16 through 19 (of 19 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The problem is that:
    1) I have a password protected page https://karinroelofsma-cucoach.nl/2019/01/24/test2/
    2) If I enter the password “test”, instead of showing the hidden content, I get redirected to https://karinroelofsma-cucoach.nl/wp-login.php
    3) This should not happen

    Actually, that redirection should happen. That’s the part you’re confused about.

    When you enter a password, then the form that you’re entering the password in for should be sending you to wp-login.php, where it will turn that entered password into a cookie, then redirect you back to the original post. Now that you have the cookie with that password in it, then you should get the post instead of the password form.

    That is how post passwords work. They go to wp-login.php with that postpass action, and that wp-login.php handles it. Basically, the form goes to https://karinroelofsma-cucoach.nl/wp-login.php?action=postpass . So, if something is blocking your system at any point along there, it can mess with that flow. If the action is getting stripped off, for example. Or whatever else you have that is incorrectly redirecting.

    @dentie Try adding this on functions.php

    //Password-Protect
    add_filter(‘allowed_redirect_hosts’, ‘amend_redirect_hosts’, 10, 2);
    function amend_redirect_hosts($allowed_hosts, $this_host){
    
    $allowed_hosts[] = $this_host;
    
    return $allowed_hosts;
    
    }

    @heykymmie This worked for me when I was having this bug.

    Thread Starter z&s

    (@dentie)

    @heykymmie Unfortunately it did not solve my problem, but thanks a lot for your suggestion!

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Password protection not working since update’ is closed to new replies.