Last Updated: February 25, 2016
· omnivoor

Deregister WP Login default stylesheet

If you are building a Wordpress based website for a client, it's a small effort to customize or white-label the login page. Sure there are existing plugins or tutorials, but this simple snippet makes it a breeze to implement.

The Wordpress codex explains that it possible to override the default styles by making your style declaration more "specific". But why load the stylesheet in the first place? This little, but handy snippet stops Wordpress from rendering the default styles on the login page. Thereafter you can register your own custom stylesheet:

function custom_remove_styles() {
    wp_deregister_style( 'wp-admin' );

add_action( 'login_init' , 'custom_remove_styles' );

function my_custom_login_css() {
    wp_enqueue_style( 'my_custom_login' , '/path/to/css/login.min.css' );

add_action( 'login_head' , 'my_custom_login_css' );