in WordPress

Set Remember Me To Be Always Checked

The Wordpress login page has a checkbox that allows you to always be remembered when you login to Wordpress. If you check this box and login successfully to Wordpress a cookie will be saved on your computer to let Wordpress know that you can bypass the login process. This makes it really for people who use your site regularly as they won't have to login each time to have access to the admin area of Wordpress. By default the checkbox is always unchecked, so you have to select it each time. I prefer this to checkbox to be selected each time so I don't have to keep clicking on the login page. Here is a snippet you can add to your functions.php file which will make sure that the checkbox is always checked when you go to the login page.


<?php

function login_checked_remember_me() {
    add_filter( 'login_footer', 'rememberme_checked' );
}
add_action( 'init', 'login_checked_remember_me' );

function rememberme_checked() {
    echo "<script>document.getElementById('rememberme').checked = true;</script>";
}
?>

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email