Hoping for some help here as I'm scratching my head. I'm trying to create a custom login page for my site which has gone rather well until I try to add in a custom CSS to make it look pretty. I'm trying to add in the style-login.css file using the following:

// add a custom css file for login page
function nb_login_style(){
            get_stylesheet_directory_uri() . '/style-login.css',
    if ( ! has_action( 'login_enqueue_scripts', 'wp_print_styles' ) ){
        add_action( 'login_enqueue_scripts', 'wp_print_styles', 11 );
add_action( 'login_enqueue_scripts', 'nb_login_style');

However the style-login.css file is never being inserted into the header of my page.

Any ideas?

2 Answers 2


Your code works just fine for me, other than small kink that all should be quoted string 'all'. But as far as WP queue is concerned it's valid.

  • I tried quoting the 'all' but that didn't make a difference. When looking at the source of my login page I still only see the main style.css being loaded. You can see for yourself here - [link]nublue.com/?page_id=587 @Rarst
    – James
    May 28, 2015 at 15:51
  • Then it might be you are including this code with wrong timing or in file that isn't running. As above — simply dropping your snippet into mu-plugin worked fine for me, the issue is not with the code you provided.
    – Rarst
    May 28, 2015 at 15:56
  • The code was inserted at the bottom of my themes functions.php. I tried moving it to the top and no change. I know that this is being executed as other actions are working just fine. Do you have any other suggestions for where to put it @Rarst?
    – James
    May 28, 2015 at 16:01
  • Not really, I don't have a guess why wouldn't it work from functions.php. Same page check — you realize that you are using a hook that is only for login pages, right?
    – Rarst
    May 28, 2015 at 16:06
  • Yep. I'm only trying to load it for my custom login page. This is really doing my head in. Thanks for trying to help anyway. @Rarst
    – James
    May 28, 2015 at 16:16

Place the following code in your theme's functions.php:

if ( ! function_exists( 'nb_login_style' ) ) :
    function nb_login_style() {
        wp_enqueue_style( 'nublue-login', get_template_directory_uri() . '/style-login.css' );
    add_action( 'login_enqueue_scripts', 'nb_login_style' );

Above code was loosely taken from:


Also, I have a plugin I created awhile back that sounds like it does exactly what you're trying to do, might be worth taking a look:


  • How is this different from what OP is doing?
    – sakibmoon
    May 28, 2015 at 18:23
  • It omits the if ( ! has_action( 'login_enqueue_scripts', 'wp_print_styles' ) ){..} if statement.
    – Ezra Free
    May 28, 2015 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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