Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Set "Remember Me" To Be Always Checked in Wordpress

DZone's Guide to

Set "Remember Me" To Be Always Checked in Wordpress

· Web Dev Zone
Free Resource

Try RAD Studio for FREE!  It’s the fastest way to develop cross-platform Native Apps with flexible Cloud services and broad IoT connectivity. Start Your Trial Today!

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;";
}

Get Your Apps to Customers 5X Faster with RAD Studio. Brought to you in partnership with Embarcadero.

Topics:

Published at DZone with permission of Paul Underwood, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}