[英]How can I redirect to home when user click on back button after logout?
I was wondering how can I redirect users to my hompage after they logged out when they hit the back button, kind of like facebook does. 我想知道如何在用户单击后退按钮后注销后将用户重定向到我的主页,就像在Facebook上那样。 I was playing around with some javascript but nothing seemed to work.
我在玩一些JavaScript,但似乎没有任何作用。
PS: This will be for a Wordpress theme. PS:这将是针对Wordpress主题的。
如果使用会话,则可以在查看经过身份验证的页面时检查用户是否已登录,如果没有,则将标题发送到您的主页。
Javascript seems like the way to do it. Javascript似乎是这样做的方法。 Simply check if the user is logged and if not, do a redirect to the home page via a document.location = "http://my.home.page";
只需检查用户是否已登录,如果没有,则通过document.location =“ http://my.home.page”;重定向到主页。
I guess that you have the session in PHP too so you could just do the redirect there instead of relying on Javascript. 我想您也有使用PHP的会话,因此您可以在那里进行重定向,而不必依赖Javascript。
header ('Location: http://your.home.page');
嗨,在那里检查wp_logout_url($ redirect_url) 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.