- Customizing the logo and link on the login form: You can use the
login_headertitle
andlogin_headerurl
filters to customize the logo and link on the login form. For example:
function custom_login_logo_title() {
return 'Your Site Name';
}
add_filter( 'login_headertitle', 'custom_login_logo_title' );
function custom_login_logo_url() {
return home_url();
}
add_filter( 'login_headerurl', 'custom_login_logo_url' );
- Customizing the login form styles: You can use the
login_enqueue_scripts
action to enqueue a custom stylesheet for the login form. For example:
function custom_login_styles() {
wp_enqueue_style( 'custom-login', get_template_directory_uri() . '/css/login.css' );
}
add_action( 'login_enqueue_scripts', 'custom_login_styles' );
- Changing the background image: You can use the
login_headerurl
filter to change the background image of the login form. For example:
function custom_login_background() {
$image_url = get_template_directory_uri() . '/images/login-bg.jpg';
return 'style="background-image: url(' . $image_url . ');"';
}
add_filter( 'login_headerurl', 'custom_login_background' );
- Redirecting users after login: You can use the
login_redirect
filter to redirect users to a specific page after they log in. For example:
function custom_login_redirect( $redirect_to, $request, $user ) {
if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
return home_url();
} else {
return admin_url();
}
}
add_filter( 'login_redirect', 'custom_login_redirect', 10, 3 );
You can use these snippets or create your own custom functions, to make the login page of your WordPress website more personalized and user-friendly. If there is anything else you are trying to do with the Wordpress login page , send me a message and I’ll definitely try and help 🙂 .