通过 Idle User Logout 可以设置在一定时间内,登录用户无操作,超时自动注销登录。可以分别对不同用户角色单独设置空闲超时时间。
安装启用插件后,WP后台 → 设置 → Idle User Logout,设置自动注销时间。文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
其它类似的插件
Inactive Logout文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
可以单独设置某个用户自动注销,并有倒计时提示。文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
configure-login-timeout文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
在用户编辑页面设置用户自动注销时限。文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
BulletProof Security文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
除了基本的自动注销功能,还有很多WordPress安全防护功能,恶意软件扫描程序,防火墙,登录安全,数据库备份,反垃圾邮件...文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
代码版(未验证)
代码一:文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' ); function keep_me_logged_in_for_1_year( $expirein ) { return 31556926; }
代码二:文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
function myplugin_cookie_expiration( $expiration, $user_id, $remember ) { return $remember ? $expiration : 600; } add_filter( 'auth_cookie_expiration', 'myplugin_cookie_expiration', 99, 3 )
至于应用场景,为了账号安全?我自己暂无此需求,既然有这么多类似的插件,应该还是有很多用户有此需求。文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
文章源自知更鸟-https://zmingcx.com/idle-user-logout.html文章源自知更鸟-https://zmingcx.com/idle-user-logout.html
陕西省渭南市韩城市 1F
鸟哥,5.9能放心升级吗?
中国 B1
@ 夜未央 可以,我已升级
重庆市 2F
下载插件试试
浙江省杭州市 3F
下载插件试试