← Back to All Snippets

Replace WordPress Login Logo and Custom URL

⚡ Target: functions.php 🔒 Tested: WP 6.6+ / PHP 8.2+ 💻 Lang: PHP
PHP (functions.php)
add_action( "login_enqueue_scripts", function() {
    echo "<style type="text/css">#login h1 a { background-image: url(" . get_stylesheet_directory_uri() . "/assets/images/logo.svg) !important; background-size: contain !important; width: 100% !important; }</style>";
} );
add_filter( "login_headerurl", fn() => home_url() );

Brand your WordPress client websites by replacing the default WordPress logo on wp-login.php and redirecting the logo URL to your homepage.

← Back to All Snippets Explore Dev Tools →