Last active
August 30, 2016 10:00
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tip! If it does not work at first then try playing with priority parameter in hook (which is 10 at the moment).