Add Custom Logo in WordPress Admin Login Page

If you want to display a custom logo instead of default WordPress logo in wp-admin login page, you need to add following code into functions.php

/*** Change Logo In Admin Login Page With URL And Title ***/
add_action('login_head', 'admin_login_logo');
function admin_login_logo() {
$logoImage = get_theme_mod( 'custom_logo' );
$logoUrl = wp_get_attachment_image_src( $logoImage , 'full' );
echo '
.login h1 a { background-image:url('. esc_url( $logoUrl[0] ) .') ! important; width:120px !important; height:90px !important;}
';
}
add_filter( 'login_headerurl', 'admin_logo_redirection' );
function admin_logo_redirection($url) {
return site_url();
}
add_filter( 'login_headertitle', 'admin_logo_title_attr' );
function admin_logo_title_attr() {
return 'title here';
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.