Have you ever felt like changing the default logo in the native wordpress login and register form? And, instead, replace it with your own logo. It is easily doable without the unwanted bloat of any extra plugin. In fact, with just a few lines of code, you can achieve your desired outcome.
Before we begin, let’s try to understand why we may need to remove or change the default wordpress logo. Actually, there can be situations when a visitor may need to click on a certain form on your wordpress site.
Let’s take the example of the built in comment form. Whenever a visitor clicks on that form, it is likely that they land on the WordPress’s native login and registration page with its default logo. As a business owner, however, you may want to display your own brand-logo there instead of the existing one.
Okay, so let’s look at the code that will help us replace the default WordPress logo with our own. You can put this code in your child theme’s functions.php file if you like doing that. If you do not have a child theme or if you do not find placing the code there convenient, you can always use a code snippet plugin and insert it there.
// Replace WordPress Logo From The Login Page.
function my_login_logo_one() {
?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(https://example.com/your-logo.png);
margin-bottom: 0px;
}
</style>
<?php
}
add_action( 'login_enqueue_scripts', 'my_login_logo_one' );
In the code above, the “https://example.com/your-logo.png” is just a sample image URL. You need to insert the exact URL of your logo’s image file in its place. That’s all.
