4

I want to remove WordPress logo from login and register page. I think I have to make some changes in .css file for this. So I want to know in which css file do I have to make the changes?

3

You can add a filter to login_head. As explained in the Codex, add this to your code:

function my_custom_login_logo() {
    echo '<style type="text/css">
    h1 a {background-image:url(http://example.com/your-logo.png) !important; margin:0 auto;}
    </style>';
}
add_filter( 'login_head', 'my_custom_login_logo' );
2
  • login_head is action, not a filter :) , however login_headerurl is filter ...
    – jave.web
    Jun 23 '17 at 13:57
  • 1
    topic starter asks to remove logo, not to replace... if he uses this, page will result a 404 error...
    – brobken
    Jul 31 '17 at 13:36
1

To remove the WordPress logo, paste the below code in functions.php of the theme directory.

function remove_logo() { ?>
<style type="text/css">
    .login h1 a { display: none; }
</style>
<?php }

add_action( 'login_enqueue_scripts', 'remove_logo' );
1

Go to your website Editor using > Appearance > Editor > function.php and add this before the last line "?>":

/* Remove WP logo from login page */

function custom_login_logo() {
    echo '<style type ="text/css">.login h1 a { display:none!important; }</style>';
}

add_action('login_head', 'custom_login_logo');
1

You can replace the logo using built-in theme editor as explained in this post.

Step 1:

Login to your WordPress site as admin and go to Media -> Add New to upload a new image and copy the image url.

You can also upload your new logo to the theme’s images directory or you can create a new directory to upload the logo. This can be done with the help of web hosting control panel or FTP.

Step 2:

Go to the Admin Dashboard -> Appearance -> Theme Editor.

Step 3:

When the editor opens, find and select functions.php from the right side of the page and add the following code to the end of the page.

function my_custom_logo() { ?>
     <style type="text/css">
         #login h1 a, .login h1 a {
             background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png);
             height:100px;
             width:100px;
             background-size: 100px 100px;
             background-repeat: no-repeat;
             margin-bottom: 10px;
         }
     </style>
 <?php } 
add_action( 'login_enqueue_scripts', 'my_custom_logo' );

Replace logo.png with the name of the file you have uploaded. If you have uploaded the new logo with WordPress, modify the background-image property as shown below.

background-image: url(url copied in step 1);

0

You don't need to go through the coding, use Custom Login plug-in to do that

0

It's best to run this after login_enqueue_scripts as mentioned by @ashin above

I'll post this since it relates to changing the logo.

To change the URL from wordpress.org to your own (along with the links title attr), use this:

    function my_login_logo_url() {
        return home_url();
   }
    add_filter( 'login_headerurl', 'my_login_logo_url' );

    function my_login_logo_url_title() {
        return 'Your Site Name and Info';
    }
    add_filter( 'login_headertitle', 'my_login_logo_url_title' );

If you want to get crazy with styling, here is the css used to edit the entire login page:

body.login {}
body.login div#login {}
body.login div#login h1 {}
body.login div#login h1 a {}
body.login div#login form#loginform {}
body.login div#login form#loginform p {}
body.login div#login form#loginform p label {}
body.login div#login form#loginform input {}
body.login div#login form#loginform input#user_login {}
body.login div#login form#loginform input#user_pass {}
body.login div#login form#loginform p.forgetmenot {}
body.login div#login form#loginform p.forgetmenot input#rememberme {}
body.login div#login form#loginform p.submit {}
body.login div#login form#loginform p.submit input#wp-submit {}
body.login div#login p#nav {}
body.login div#login p#nav a {}
body.login div#login p#backtoblog {}
body.login div#login p#backtoblog a {}
2
  • The login_headertitle filter has been deprecated (as of version 5.2.0) in favour of the login_headertext filter, FYI.
    – Pat J
    Apr 22 at 18:24
  • 1
    Thanks for the catch, I've updated/corrected my post accordingly. Cheers
    – revive
    Apr 23 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.