Category: Login
Last Login Column
// Please note: This snippet will only show the last login date & time AFTER the snippet is activated. // The snippet has to be active to track the last login date & time. // Add a column to the…Continue reading
Hide “Remember Me”
add_action( ‘login_enqueue_scripts’, function() { echo ‘ ‘; } );Continue reading
Allow Only Logged-In Users
add_action( ‘wp’, static function () { if ( is_user_logged_in() ) { return; } // Handle API requests separately. if ( defined( ‘REST_REQUEST’ ) && REST_REQUEST ) { return; } // Allow access to the login screens. $allowed = array( ‘wp-login.php’…Continue reading
Extend Login Expiration Time
add_filter( ‘auth_cookie_expiration’, function () { return 30 * DAY_IN_SECONDS; // 30 days in seconds. } );Continue reading
Disable Login Autofocus
add_filter( ‘enable_login_autofocus’, ‘__return_false’ );Continue reading
Remove Login Shake Animation
add_action( ‘login_footer’, function () { remove_action( ‘login_footer’, ‘wp_shake_js’, 12 ); } );Continue reading
Replace WordPress Logo on Login Page
add_filter( ‘login_head’, function () { // Update the line below with the URL to your own logo. // Adjust the Width & Height accordingly. $custom_logo = ‘https://wpcode.com/wp-admin/images/wordpress-logo.svg’; $logo_width = 84; $logo_height = 84; printf( ‘ ‘, $custom_logo, $logo_width, $logo_height );…Continue reading