Select Page

Customize the Default WordPress Login Page Without Plugins

Let’s take a look at how to customize the default WordPress login page without using any plugins.

Changing the Logo

First, open your functions.php file in your child theme and drop in the following function:

function my_loginlogo() {
  echo '<style type="text/css">
    h1 a {
      background-image: url(' . get_template_directory_uri() . '/path/to/your/logo.png) !important;
add_action('login_head', 'my_loginlogo');

Just keep in mind that get_template_directory_uri() returns the root directory of your parent theme. To return the root directory of your child theme, use get_stylesheet_directory_uri(). If your logo is someplace else, like in your uploads directory for example, you can use the wp_upload_dir() function instead.

A Note about wp_upload_dir()

wp_upload_dir() actually returns an array, so if you call it in a function like this, expecting it to return a url or a file path, you’ll end up getting an error, and could potentially lock you out of your site.

In my case, I’ve saved my logo in my uploads directory, so I used the ['baseurl'] item in the returned array. Here’s another example of what your image URL path could look like from the above function call:

function my_loginlogo() {
  echo '<style type="text/css">
  h1 a {
    background-image: url(' . wp_upload_dir()['baseurl'] . ' path/to/your/logo.png) !important;
add_action('login_head', 'my_loginlogo');

Also, don’t forget to use single quotes inside your array selector for wp_upload_dir(). If you try something like wp_upload_dir()[baseurl], it won’t work.

Change the Logo URL

Now that you’ve got the custom logo loaded, you can have it link to anywhere with another functions.php call

function my_loginURL() {
    return '';
add_filter('login_headerurl', 'my_loginURL');

Change the Logo Tooltip

If you’re getting an annoying tooltip on your logo that says “WordPress” by default, you can change it like so:

function my_loginURLtext() {
    return 'A Better Tooltip or nothing at all';
add_filter('login_headertitle', 'my_loginURLtext');

Add Custom CSS

Enqueue the new stylesheet, specifically for the login page like so:

function my_logincustomCSSfile() {
    wp_enqueue_style('login-styles', get_stylesheet_directory_uri() . '/path/to/your/styles.css');
add_action('login_enqueue_scripts', 'my_logincustomCSSfile');

Add Custom Link(s) Below Form

function my_loginfooter() { ?>
    <p style="text-align: center; margin-top: 1em;">
    <a style="text-decoration: none;" href="">If you have any questions, visit my awesome site
<?php }

Bonus: Redirecting Users After Logging In

function my_loginredrect( $redirect_to, $request, $user ) {
  if ( isset( $user->roles ) && is_array( $user->roles ) ) {
    if( in_array('administrator', $user->roles)) {
      return admin_url();
    } else {
      return site_url();
  } else {
      return site_url();
add_filter('login_redirect', 'my_loginredrect', 10, 3);

Hiding or Changing the Login Page URL

It should be noted that this isn’t recommended from a “security through obscurity” standpoint as elaborated on by the CEO of Wordfence.

But if you still want to proceed, it’s pretty straightforward, again, without using plugins, just duplicate your wp-login.php file and name it something else like new-login.php. Inside the new file, you’ll want to run a search and replace for wp-login within that file and replace it with whatever you named your new login file. So in my example, you’ll run a search within wp-login.php and replace every instance of wp-login with new-login

Next, you’ll need to register your new login URL in functions.php:

 * Change WP Login file URL using "login_url" filter hook
add_filter( 'login_url', 'custom_login_url', PHP_INT_MAX );
function custom_login_url( $login_url ) {
	$login_url = site_url( 'new-login.php', 'login' );	
    return $login_url;

Once you’ve dropped that in your functions.php and uploaded your new-login.php file, you’ll want to test your new login URL to ensure it’s working properly. If everything checks out, you can trash your original wp-login.php file.

Check out more articles

Elevate Your Digital Presence with a Top Tampa Web Design Company

If you’re a business owner in Tampa, partnering with a professional web design company can make all the difference. In this article, we’ll explore the benefits of working with a Tampa web design company and how it can elevate your digital presence.

Create a Custom API Endpoint in WordPress

Creating a custom endpoint in WordPress to check for plugin updates involves several steps. This process includes setting up a custom REST API endpoint, creating a function to handle requests to this endpoint, and ensuring that the response contains the necessary...

Deploy WordPress Updates from a Private Repository

To push code to a private repository and trigger a pending WordPress update badge, you need to follow a systematic approach involving version control, continuous integration/deployment, and the appropriate use of WordPress hooks and filters. Here’s a step-by-step...

How to Generate a Ranger Config File

ranger --copy-config=all This will copy all the default config files from /usr/local/lib so you can make edits without messing anything up. Huge shout out to for explaining this and so much more. Took me a...

First Open Source Contribution

Surprise! I genuinely did not plan on making my first ever open source contribution today. In fact, I didn't plan on a lot of things happening this week at all. I recently got an awesome opportunity to work on a site that is being hosted on a platform called Pantheon,...

How to Exclude Specific Posts and Pages from WP_QUERY

For the sake of having something to work with, let's suppose we've got the following query:In this query, inside the $args array, there's a special parameter that allows you to exclude specific posts and pages from the query. This parameter is called post__not_in and...

Configure SSH For Password-less Connections

Preamble I'm slightly embarrassed to admit this, but it was a long time before I figured out how amazing this little file is and how exactly to put it to good use. The file I'm talking about is the SSH config file. By default, when you first connect to a server via...

WordPress Site Stuck in Maintenance Mode

Plugin Error Code 500 During Update While I was updating a WordPress plugin locally, something happened on my local server to trigger a 500 error code as the plugin was updating. On the frontend, I refreshed the page and was greeted with "Briefly Unavailable for...

Creating a WordPress Plugin Downloader

How it Started I was recently tasked with the challenge of creating a WordPress theme generator. The idea being, instead of writing your style.css file from scratch, you'd be able to just answer a few simple questions about how you'd like your theme set up, and those...

Fix Audio on XFCE Chromebook

The Problem After moving from GalliumOS to Xubuntu, I noticed that playing YouTube videos on both Firefox and Chromium would result in decent playback for a few minutes, but suddenly the audio would turn into a solid beeping tone while the YouTube video displayed the...

Looking for a place to host your next project or design?

Use this link to get your first 4 months of WP Engine for free: WP Engine – Plans (With 4 months free)