With wordpress 4.6.1 is it possible to create a child theme layout of the wp-login page with its own CSS this way original wp-login page and it's defaults are preserved?

How can I hook into the head of this page for custom stylesheets and hook into the body for custom html?

  • 1
    There are hooks to customise the login page, yes. If no-one else beats me to it I'll try an answer when I have more time. – Andy Macaulay-Brook Oct 8 '16 at 9:59

In functions.php in your child theme, you can do a couple different things on the login screen. First, you'll want to add a custom stylesheet by hooking into login_enqueue_scripts.

add_action( 'login_enqueue_scripts', 'wpse_login_styles' );
function wpse_login_styles() {
    wp_enqueue_style( 'wpse-custom-login', get_stylesheet_directory_uri() . '/style-login.css' );

Then you can create a styles-login.css file in the root of your child theme directory (or adjust the path in wp_enqueue_script based on your needs).

Once you've made it that far, you can customize the login page however you'd like using CSS in that file. For example, change the login logo with these instructions ripped from the Codex:

#login h1 a, .login h1 a {
    background-image: url(path/to/login/logo.png);
    padding-bottom: 30px;

Beyond CSS, you can also change the URL and site title on this page using the login_headerurl and login_headertitle hooks, also described in the above Codex link.

If you want to go further like adding elements to the page, or even creating a custom login page, that's all described here and here.

  • Very cool! This is such a clean process, with no forced hacking - love it! – klewis Oct 11 '16 at 19:54
  • But is there a way to modify the php and html code, outside of the wp-login file? – TARKUS Jun 4 at 12:29
  • 1
    @TARKUS Only by using the provided actions and filters on the wp-login.php page. For example, you could add code via login_head or login_footer actions or you could change things around using Javascript as well. – brianjohnhanna Jun 8 at 13:23

You can check out the code on the plugin I made a while back, WP Login Flow: https://github.com/tripflex/wp-login-flow

Everything in the plugin for customizing wp-login.php should still work just fine, but I haven't updated it in a while after they made the change to the way the user passwords were handled. If anything the code should give you a good idea of how to completely customize it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.