So the plugin I wrote about last post didn’t handle everything like I thought it did. If a user entered their password incorrectly, they were brought straight to the default wp-login.php page with the WP logo staring them right in the face. Exactly what my client did not want. It turns out this was a conflict with other functions that I had running so I had to work around it.
After searching through many half-helpful articles on how to customize the WordPress login page without a plugin, I finally got my most helpful information straight from the wp-login.php file. Whodathunk eh?
Hook: login_head
Use: add_action('login_head', 'yourfunctionname');
This will hook you into the <head> tag of the login page. I used it to throw in some CSS to alter the login page. Only to change the button color and replace the WordPress logo image (it’s a background-image). So I used:
function v_login_logo() {
echo '';
}
Great. But the logo is still linked to WordPress.org. For that, wp-login.php tells us there’s a filter for that:
Filter: login_headerurl
Use: add_filter('login_headerurl', 'yourfunctionname');
While you’re at that, you might as well change the title tag of the image so it isn’t wordpress.org by using:
Filter: login_headertitle
Use: add_filter('login_headertitle', 'yourfunctionname');
So using those two filters and one hook, I replaced the login logo image, image url, and image title attribute. You can change any other CSS you’d like using that hook too.
I learned a neat php trick from one of the articles I found (long forgotten which of the many) with a command called create_function. I used it with my filters like this:
add_filter('login_headerurl', create_function(false, "return 'http://wwwmysiteurl.com';"));
As you can see, it created my function within my filter call. Handy. I have no idea what the “false” is for at the beginning. Maybe someone else can tell me.
Happy login customizing. More and more lately I like to avoid plugins where I can and sharpen my skills interacting with WordPress on my own. Time consuming, but eventually I can make my own plugins. There’s value in always knowing what’s going on under the hood.

Learn more about WordPress