Pre-tick the "Remember Me" box on the login form so users stay logged in for two weeks instead of until they close the browser.
add_action( 'login_footer', function (): void {
?>
<script>
( function () {
var box = document.getElementById( 'rememberme' );
if ( box ) {
box.checked = true;
}
} )();
</script>
<?php
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
Without “Remember Me”, WordPress logs users out when they close their browser. On sites where people log in often, like membership sites or stores, that’s annoying. This snippet ticks the box for them.
login_footer runs at the bottom of the login page. The small script finds the checkbox with the ID rememberme and ticks it. Users can still untick it on a shared computer.
Log out and open the login page. The “Remember Me” box should already be ticked.