How to change WordPress logo from WordPress login page

You are currently viewing How to change WordPress logo from WordPress login page

How to change WordPress logo from WordPress login page

There are several ways to change the logo on the WordPress login page. Here are a few methods:

  1. Using the login_head hook:
Copy codefunction custom_login_logo() {
    echo '<style type="text/css">
        h1 a { background-image: url('.get_stylesheet_directory_uri().'/images/custom-logo.png) !important; }
    </style>';
}
add_action('login_head', 'custom_login_logo');

This code uses the login_head hook to add a custom CSS rule to the login page that changes the logo to an image called “custom-logo.png” located in the images folder of your theme.

  1. Using the login_headerurl and login_headertitle hooks:
Copy codefunction custom_login_logo_url() {
    return home_url();
}
add_filter( 'login_headerurl', 'custom_login_logo_url' );
 
function custom_login_logo_url_title() {
    return get_bloginfo( 'name' );
}
add_filter( 'login_headertitle', 'custom_login_logo_url_title' );

This code uses the login_headerurl and login_headertitle hooks to change the URL and title of the default logo on the login page to your site’s homepage.

  1. Using a plugin: There are many plugins available in the WordPress plugin repository that allow you to change the logo on the login page with a few clicks, such as “Custom Login Page Customizer” or “Login Designer”. These plugins provide a user-friendly interface for customizing the login page, including the logo.

It’s important to note that you should call these functions only on the ‘login_head’ and ‘init’ action hooks, to make sure that the necessary WordPress functionality is available.

By using any of these methods, you can change the logo on the WordPress login page to any image you like, and also you can change the link of the logo, and change the title of the logo.

if you need any help in wordpress development click here

Leave a Reply