Customize the WordPress Login Page – WortGepresst


Customize the WordPress Login Page

  1. Add a custom background
  2. Replace the WordPress logo with a custom logo
  3. Customize the look of the login form
  4. Change the login logo URL
  5. Remove the lost password link
  6. Remove the “Back to” link
  7. Hide the login error message
  8. Remove the login page shake
  9. Change the redirect URL
  10. Set “Remember Me” to checked

The login page isn’t part of the WordPress theme setup and if you’ve ever tried to customize the login page you would have discovered that WordPress doesn’t load your theme’s stylesheet. But that’s okay because we can create our own.
Here’s what you need to do:

  1. In your current theme’s folder, create a new folder called “login”
  2. In the /login folder, create a new .txt file and name it custom-login-styles.css
  3. Next, we’ll need to tell WordPress to load this CSS file, so open up your theme’s functions.php file and add the following code:

Now let’s get started.

Add a Custom Background

For our WPMU DEV-inspired login page, we’re going to use the racing car image from our homepage (if you can’t remember what it looks like, logout and check out our homepage).
We can achieve this by adding the following to our custom-login-styles.css file:

Make sure you replace the file name in line 2 with the name of your own image file.

Replace the WordPress Logo With a Custom Logo

The WordPress Codex provides a tidy explanation for how to replace the logo, but since we’ve already created a CSS file we can just add the following to that file:

Save the logo you want to use in your /login folder where your custom-login-styles.css file is also stored.
Don’t forget to replace the file name in line 2 with the name of your own logo file.

Customize the Look of the Login Form

Now we’re going to play with the look of the login form so it better matches the WPMU DEV branding, but you can change the CSS however you like to match the look and feel of your own site.
First, we’ll style the labels to make the text darker, and the form input boxes to give them a more rounded look:

Next, we’ll style the button to make it a lighter shade of blue:

While the changes are subtle, they better match the WPMU DEV branding.

Change the Login Logo URL

By default, the logo links to You can change this to point to your own site by adding this code to your functions.php file:

Replace “Your Site Name and Info” in line 7 with the name of your site. This is simply ALT text for the logo.

Remove the Lost Password Link

The “Lost Your Password?” link is helpful if you’ve lost your password, but if someone has hacked your email they will be able to get hold of your WordPress password and take over your site.
To remove the link, add this to your CSS file:

Remove the “Back to” Link

The “Back to…” link lets users return to the homepage of your site. I’m going for a clean look and don’t want to display the text under my form. To remove it, add the following to your CSS file:

Hide the Login Error Message

When you enter an incorrect username or password, the login page returns an error message telling you which details you got wrong. If your username is correct but password is wrong, it will say your password was wrong. If you typed the wrong username, it says “Invalid Username.” While the message may be helpful for you, the problem is that hackers can use this information to guess your login credentials and gain access to your website.
The easiest way around this is to change the error message with this code in your functions.php file:

Simply update line 3 to change the error message.

Remove the Login Page Shake

When you enter an incorrect username or password, the login form shakes to alert the user they need to try again.
I don’t really mind this feature, but some people find it annoying. To remove the shake, add this snippet to your functions.php file:

Change the Redirect URL

When you login to WordPress you’re immediately taken to the dashboard. You can easily change this to redirect users to your homepage instead.
Add the following code to your functions.php file so that all users other than admin are automatically redirected:

Set “Remember Me” To Checked

The “Remember Me” checkbox is unchecked by default. I like to check this when I login, but sometimes I forget, only to realize afterwards that I forgot and it’s too late. Doh!
To leave this box always checked, add this snippet to functions.php:

So there you go. With a few simple modifications you can easily personalize you login page to match the look and feel of your site.

Font Resize
Zur Werkzeugleiste springen