Automatic logout from WordPress after leaving protected area
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();
}
精彩评论