开发者

Automatic logout from WordPress after leaving protected area

开发者 https://www.devze.com 2023-02-04 18:39 出处:网络
I have a wordpress site and I need the function so if yo开发者_运维技巧ur logged into a protected page and you leave that page you cannot hit the back button and go back without signing in again.

I have a wordpress site and I need the function so if yo开发者_运维技巧ur logged into a protected page and you leave that page you cannot hit the back button and go back without signing in again.

How to achieve that?


Well the admin area is always at /wp-admin and id imagine it uses session authentication so why don't you just put a piece of code into your index file, or any other file that gets called on each page load that deletes the session if the url doesn't begin with /wp-admin For example:

if(substr($_SERVER['REQUEST_URI'], 0, 9)!='/wp-admin') {
    session_destroy();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消