且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

受 Wordpress 保护的页面,其他页面上的 POST 表单

更新时间:2023-12-01 23:20:34

好吧,我做到了

这实际上不是解决这个问题的好方法,因为您需要覆盖一些 wordpress 文件(wp-login.php).

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

1) 使用密码将您的页面设为私密

1) Set your page private with a password

2) 将此表单插入其他页面(典型的 postpass wordpress 表单):

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) 更改您的/wp-login.php 文件(根目录,此时位于第 460 行):

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" );