2

For reason unbeknownst to me (I'm not the original developer). This custom WordPress site doesn't show the password protected login form..."This content is password protected! To view it please enter your password below:".

The page shows it's protected, but visitors can still see the full page. I manage to use the code that works that triggers the form and block access.

After entering the correct password. The page redirects to /wp-login.php?action=postpass which is just a blank page. From all the solutions I've tried in functions.php and editing the code below doesn't seem to work. Has anyone have a similar issue or fix that redirects to same sage to show the protective content?

<?php if ( post_password_required() ) { ?>
<form method="post" action="/wp-login.php?action=postpass">
    <p>This content is password protected. To view it please enter your password below:</p>
    <input type="password" style="margin:10px 0;" size="20" id="pwbox-<?php the_ID(); ?>" name="post_password"/></label><br/>
    <input type="submit" value="Submit" name="Submit"/></p>
</form>
<?php } else { ?>
    // echo out all of the post content
<?php } ?>
3
  • Did you turn on permalinks? did you try turning it off and test to see if it works? Apr 9, 2020 at 1:22
  • @simongcc I tried that. Nothing happens Apr 9, 2020 at 15:46
  • do you have captcha protection when you login?
    – Ooker
    Jul 24, 2020 at 11:30

1 Answer 1

2

I've also struggled with this. Although I still don't really understand what causes the problem, I've managed to bypass it, by installing a login redirect plugin and changing the standard login URL from www.yourwebsite.com/wp-login.php to www.yourwebsite.com/login. The plugin I used can be downloaded from https://nl.wordpress.org/plugins/rename-wp-login/, but I'm pretty confident that any login redirection plugin would work. So, this way you don't have to edit your functions.php. This bypasses any default Google reCaptchas, by the way.

I would still love to know what the problem is caused by though.

1
  • Thanks, actually I was trying to solve it for hour or so, after that I test your solution, works fine, really no clue what cause this issue, but I was able to fix it thanks to you
    – Isu
    May 25, 2020 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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