Replace WP login logo

Replace WP default Logo with simple PHP function

After WP installed, the login screen will displace a default logo

login with WP default logo

Replace the default logo by simple PHP function

Since this is going to edit the theme, it is recommend to do this in child theme. This will prevent the PHP function being removed after the theme is updated.

Select Appearance > Theme Editor

Choose and edit functions.php

Add the following codes into the functions.php

Replace “http://www.yourdomain.com/wp-content/uploads/2020/09/login_logo.png” with the logo url.

URL can be copied by selecting the logo in Media.

Save the functions.php

Logout once, will see the default logo replaced by the site logo

If logo did not get updated, double check the URL of the media file, or try purge cache.

function my_login_logo_one() {
?>
<style type=”text/css”>
body.login div#login h1 a {
background-image: url(http://www.domainname.com/wp-content/uploads/2020/10/sitelogo.png); //Add your own logo image in this url
padding-bottom: 30px;
}
</style>
<?php
} add_action( ‘login_enqueue_scripts’, ‘my_login_logo_one’ );

Our time: 6:50pm UTC
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.