简体   繁体   中英

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. I was playing around with some javascript but nothing seemed to work.

PS: This will be for a Wordpress theme.

如果使用会话,则可以在查看经过身份验证的页面时检查用户是否已登录,如果没有,则将标题发送到您的主页。

Javascript seems like the way to do it. 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";

I guess that you have the session in PHP too so you could just do the redirect there instead of relying on Javascript.

header ('Location: http://your.home.page');

嗨,在那里检查wp_logout_url($ redirect_url)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM