Learn in this tutorial how to replace the WordPress logo on the login page with the website logo using code.
By default, the login page in WordPress displays your logo just above the “Username” and “Password” fields.
But what if instead of seeing the WordPress logo, you prefer to see the website’s logo?
In a previous tutorial I already explained how to add the custom logo of your choice, but you had to do it manually.
However, this time you are going to get the main logo of the website displayed directly.
This would be the result:
Little details like this help your customers feel a little more like they own the website. 😉
Here’s how to do it:
Snippet to replace the logo on the WordPress login page with the website’s own logo
Add the following code at the end of functions.php or in your functionality plugin:
To see this and another 1097 code snippets of this website, login or subscribe here.
In this case you use the login_head
hook to modify the background image, which by default is the WordPress logo, to replace it with the one of the website thanks to the get_custom_logo
function.
You can finish adjusting the size of the logo to your liking by modifying the width and height parameters.
I also recommend that you change the URL of the image, which by default goes to WordPress.org, to that of your home page. To achieve that, add the following right after the previous snippet:
To see this and another 1097 code snippets of this website, login or subscribe here.
Conclusion
With a few lines of code you can replace the logo displayed on the WordPress login page with the logo of your website.
I am convinced that your customers will appreciate this kind of details.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂