Skip to content
Useful Blogging
  • Blogging
  • Make Money
  • Software Reviews
  • Marketing
  • Tools
  • About
    • Blog
    • Advertise
    • Contact

Home » WordPress » Modify the Login Logo & Image URL Link in WordPress

Modify the Login Logo & Image URL Link in WordPress

February 18, 2025 by Ataul Ghani

Most of the users want to change the WordPress login logo to their own custom logo. But a part of them use third party plugins. Now, this code will allow you to easily modify the WordPress Login page Logo as well as the href link and title text of this logo without using any third party plugins.


add_filter( 'login_headerurl', 'namespace_login_headerurl' );
/**
* Replaces the login header logo URL
*
* @param $url
*/
function namespace_login_headerurl( $url ) {
$url = home_url( '/' );
return $url;
}
add_filter( 'login_headertitle', 'namespace_login_headertitle' );
/**
* Replaces the login header logo title
*
* @param $title
*/
function namespace_login_headertitle( $title ) {
$title = get_bloginfo( 'name' );
return $title;
}
add_action( 'login_head', 'namespace_login_style' );
/**
* Replaces the login header logo
*/
function namespace_login_style() {
echo '<style>.login h1 a { background-image: url( ' . get_template_directory_uri() . '/images/logo.png ) !important; }</style>';
}

If you want to use the site logo to replace the login logo, you can use the following to dynamically pull that information.


function namespace_login_style() {
if( function_exists('get_custom_header') ){
$width = get_custom_header()->width;
$height = get_custom_header()->height;
} else {
$width = HEADER_IMAGE_WIDTH;
$height = HEADER_IMAGE_HEIGHT;
}
echo '<style>'.PHP_EOL;
echo '.login h1 a {'.PHP_EOL;
echo '  background-image: url( '; header_image(); echo ' ) !important; '.PHP_EOL;
echo '  width: '.$width.'px !important;'.PHP_EOL;
echo '  height: '.$height.'px !important;'.PHP_EOL;
echo '  background-size: '.$width.'px '.$height.'px !important;'.PHP_EOL;
echo '}'.PHP_EOL;
echo '</style>'.PHP_EOL;
}

Share on:
Check Out These Related Posts:
  1. 12 Best WordPress LMS Plugins in 2025
  2. 8 Best WordPress Table of Contents Plugins 2025 (Free & Paid)
  3. 11 Best WordPress Instagram Plugins in 2025

Disclosure: When you buy through links on our site, we may earn an affiliate commission. Commissions do not affect our writers' opinions or evaluations.
Photo of author
Written by Ataul Ghani
Ataul brings 14 years of expertise in Web Development and SEO, with a strong focus on WordPress, Technical SEO, and Page Speed Optimization. He is passionate about helping people build websites to grow their businesses online.

Recent Posts

  • 17 Best Laravel Admin Templates in 2025
  • 10 Legal Situations That Definitely Need a Lawyer 2025
  • 10 Best AI Detectors 2025: Identify AI-Generated Text Easily
  • 5 Essential Tips for Opening an Online Shop
  • 12 Best WordPress LMS Plugins in 2025
  • 8 Best WordPress Table of Contents Plugins 2025 (Free & Paid)

Pages

  • About Us
  • Advertise
  • Tools & Resources
  • Contact Us
  • Facebook
  • X
  • Pinterest

Categories

  • Blogging
  • Business
  • Make Money
  • Marketing
  • SEO Guide
  • Software Reviews
  • WordPress
  • Tips and Tricks

Lern

  • Make a Website
  • Start A Shopify Store
  • Make Money Blogging
  • Amazon Affiliate Marketing
  • Google AdSense Approval
  • Privacy Policy
  • Terms and Conditions
  • Cookies
  • Affiliate Disclosure
  • Sitemap
Copyright © 2014 - 2025 Useful Blogging