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 } ?>

1 Answer
1

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.

Leave a Reply

Your email address will not be published. Required fields are marked *