WordPress – or should I say JetPack – has a lovely habit of loading a large amount of cruft that you may not want on your page. After the recent WP 4.6.x update I found the custom login page on one of my sites didn’t load properly anymore, because all the custom css was being over-ridden by css files WP was injecting at page load. This function stops this injection:
add_action( 'login_init', function() {
wp_deregister_style( 'login' );
wp_register_style( 'login', "" );
wp_deregister_style( 'buttons' );
wp_register_style( 'buttons', "" );
wp_deregister_style( 'l10n' );
wp_register_style( 'l10n', "" );
wp_deregister_style( 'forms' );
wp_register_style( 'forms', "" );
wp_deregister_style( 'dashicons' );
wp_register_style( 'dashicons', "" );
} );
