您可以在提交联系人表单时设置cookie,然后在上检查cookie/page2
. 如果找不到,wp_safe_redirect()
返回到/page1
.
Setting a cookie - 您需要连接到联系人表格7的提交文件中-查看他们的文档:
<?php
setcookie( \'my_cookies_name\', true, 0 ); // This cookie will expire after the session
?>
检索cookie(打开
/page2
\'s php模板:
<?php
if( is_page(\'page2\') ) {
// Because the value is set to true, you can just check for the value in if()
if( ! $_COOKIE[\'my_cookies_name\'] ) {
// cookie isn\'t found, redirect back
wp_safe_redirect( site_url(\'/page1\') );
}
}
?>