Skip to content

Instantly share code, notes, and snippets.

@knolaust
Last active January 30, 2024 14:45
Show Gist options
  • Save knolaust/2f37b6a6a33530bb43135a86054f88a8 to your computer and use it in GitHub Desktop.
Save knolaust/2f37b6a6a33530bb43135a86054f88a8 to your computer and use it in GitHub Desktop.
Replace WordPress Logo on Login Page
<?php
/**
* Customize WordPress Login Logo.
*
* This code replaces the default WordPress logo on the login page with a custom logo.
* Update the URL to your custom logo and adjust the width and height accordingly.
*
* Gist Keywords: wordpress, admin, login
*
* @category WordPress
* @version 1.0.0
* @author Knol Aust
*/
add_filter( 'login_head', function () {
// Update the line below with the URL to your own logo.
$custom_logo = 'https://example.com/path-to-your-logo.png';
$logo_width = 84;
$logo_height = 84;
printf(
'<style>.login h1 a {background-image:url(%1$s) !important; margin:0 auto; width: %2$spx; height: %3$spx; background-size: 100%%;}</style>',
$custom_logo,
$logo_width,
$logo_height
);
}, 990 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment