Skip to content Skip to sidebar Skip to footer

Wordpress Protected Page, POST Form On A Other Page

I, I'm trying to add a form to a page, that send password to the wp-login.php?action=postpass via POST method, and then redirect the user to the protected page. Problem is the acti

Solution 1:

Ok guys, i did make it

This is actually not a good solution to this problem, because you will need to override some wordpress files (wp-login.php).

1) Set your page private with a password

2) Insert this form in an other page (typique postpass wordpress form) :

<form action="https://exemple.com/wp-login.php?action=postpass" class="post-password-form" method="post" id="go-pro-espace">
     <input name="post_password" id="exemple" type="password" size="20" /><br />
     <input type="submit" value="submit">
</form>

3) Change your /wp-login.php file (root directory, at this time, this is located line 460) :

from:
wp_safe_redirect( wp_get_referer() );
to:
wp_safe_redirect( "https://exemple.fr/your-protected-page" );

Post a Comment for "Wordpress Protected Page, POST Form On A Other Page"