当前位置: 首页 > 阿里云优惠 > 阿里云服务器优惠>> WordPress登录自动勾选记住我的登录信息 – WordPress 教程

WordPress登录自动勾选记住我的登录信息 – WordPress 教程


WordPress登录自动勾选记住我的登录信息 – WordPress 教程
WordPress

WordPress登录时有个“记住我的登录信息”勾选,默认14天内将自动登录,除非你手动注销。如果你总是忘记勾选这个复选框,这本文的技巧将帮你自动勾选。

将以下代码添加到当前主题 functions.php 文件:

add_filter( 'login_footer', 'always_checked_rememberme' );function always_checked_rememberme() {    echo "<script>document.getElementById('rememberme').checked = true;</script>";}

如果你想隐藏这个复选框,可以将下面的代码添加到当前主题 functions.php模板文件中:

add_action('login_head', 'remove_remember_me');function remove_remember_me(){            echo '<style type="text/css">.forgetmenot { display:none; }</style>';}

另外,想延长自动登录时间,可以将下面的代码添加到当前主题 functions.php模板文件中:

add_filter( 'auth_cookie_expiration', 'custom_login_cookie' );function custom_login_cookie() {    return 31536000; // one year in seconds}

服务器购买/咨询热线:1563700917115617636856

本文链接:http://www.sqxnmj.com/alfwq/28130.html
tags:
腾讯云服务器特惠

  • 关注微信
是否收录:

猜你喜欢

微信公众号