Platinum Partner
css,html5,tips and tricks,html & xhtml

Set "Remember Me" To Be Always Checked in Wordpress

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.

function login_checked_remember_me() {
	add_filter( 'login_footer', 'rememberme_checked' );
}
add_action( 'init', 'login_checked_remember_me' );
function rememberme_checked() {
	echo "document.getElementById('rememberme').checked = true;";
}

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}