Skip to content

Instantly share code, notes, and snippets.

@sjaved87
Last active August 30, 2016 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjaved87/7cd83cd15b76b4206b171f89ff844d69 to your computer and use it in GitHub Desktop.
Save sjaved87/7cd83cd15b76b4206b171f89ff844d69 to your computer and use it in GitHub Desktop.
Remove the default WordPress admin-bar.css file and replace it with your own custom one located in your active theme or child theme. You can remove and replace other admin css files too using the same method if you know the css handle.
<?php
function sjaved_remove_and_replae_admin_bar_stylesheet(){
//Remove the existing stylesheets
wp_dequeue_style( 'admin-bar' );
wp_deregister_style( 'admin-bar' );
//Enque the custom CSS file from your current theme or child theme
wp_enqueue_style( 'custom-admin-bar', get_stylesheet_directory_uri() . '/custom-admin-bar.css', false, '1.0.0' );
}
add_action('admin_enqueue_scripts', 'sjaved_remove_and_replae_admin_bar_stylesheet', 10);
@sjaved87
Copy link
Author

Tip! If it does not work at first then try playing with priority parameter in hook (which is 10 at the moment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment