Is there some way to avoid the load of default WordPress styles in login screen to only load my custom stylesheets?

Actually I'm using this code:

function login_styles() {
    // Sets the styles if is the current theme
    if (get_stylesheet_directory() == get_template_directory()) {
        // Prints link to stylesheed login.css
add_action( 'login_enqueue_scripts', 'login_styles' );

It works well but WordPress first loads its styles. I want to exclude that files from this screen.


3 Answers 3


Using wp_deregister_style( 'login' ) to remove the login styles will still result in a 404'd request for the login CSS file. However, if you re-register the login style after deregistering it you can prevent the unwanted request.

add_action( 'login_init', function() {
    wp_deregister_style( 'login' );
    wp_register_style( 'login' );
} );

This will leave you with a completely unstyled wp-login.php page. To restyle it you could instead register your own CSS file under the login handle.

This might be more helpful than messing with the style_loader_tag filter.


login_enqueue_scripts is a more appropriate action and dequeuing doesn't result in a 404.

add_action( 'login_enqueue_scripts', function() {
    wp_dequeue_style( 'login' );
} );
  • wp_register_style( 'login',false ); to remove error that comes up. Commented Mar 30, 2016 at 15:27

Following the lead of a G.M. comment in a deleted answer, where he points out that the login styles are printed with wp_admin_css() *, I've found a filter that does the job, style_loader_tag. But further tests show that wp_deregister_style is enough.

Feedback and further-further tests reveal that deregistering the style produces a 404 for wp-admin.css, so back to the loader tag:

add_action( 'login_init', function() 
    # Produces a 404 for the style
    // wp_deregister_style( 'wp-admin' );

    # The following is a filter in /wp-includes/class.wp-styles.php
    # Completely cleans up the <head> of enqueues
    add_filter( 'style_loader_tag', '__return_null' );

* There's even a filter inside this function, but seems that it doesn't catch registered styles.

  • Thanks for te answer. But that code only deregisters the styles, the CSS file stills being requested in the HTML with a 404 response, so the page is trying to load the styles. Commented Sep 25, 2013 at 10:45
  • I'm trying to use this function wp_dequeue_style() with the code you have provided to avoid WordPress prints that styles in the web, but doesn't seem to do nothing. Commented Sep 25, 2013 at 14:57
  • I didn't notice the 404 for deregister style, but the second option, style_loader_tag works without any glitch.
    – brasofilo
    Commented Sep 25, 2013 at 15:04
  • I get a look to the WordPress wp-login.php code and found the nexy code: wp_admin_css( 'wp-admin', true ); wp_admin_css( 'colors-fresh', true ); That function wp_admin_css() with the 2th arg to TRUE prints the registered styles without enqueuing them. Commented Sep 25, 2013 at 15:19
  • @AlbertFM, answer updated, seems that you didn't try the second option...
    – brasofilo
    Commented Sep 25, 2013 at 15:25

Found the way to remove the styles from the login screen:

function login_styles_reset( $style ) {
    if ( strpos( $style, 'wp-admin-css') !== FALSE ) {
        $style = NULL;
    } elseif ( strpos( $style, 'colors-fresh-css') !== FALSE ) {
        $style = NULL;
    return $style;

function custom_login_styles() {
    add_filter( 'style_loader_tag', 'login_styles_reset' );

    // Code for the new login styles
add_action( 'login_init', 'custom_login_styles');

Hope that helps someone else.

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.