WordPress is very flexible. You can do tons of things and customization with it. When activated, some plugins automatically ads their css stylesheet to your WordPress blog. This is great in most cases, but it is a lot cleaner to have all your css styles in one stylesheet. How can you remove a CSS file that was registered with wp_enqueue_style
?
There are very simple way to disable specific plugin’s stylesheet.
Step1:
Open plugin file and look for code starting with wp_enqueue_style
( $handle, $src, $deps, $ver, $media );. Look for handle name.
Sample: If you are using Redirection Plugin, look for below line of code and get handle name redirection
.
1 |
wp_enqueue_style( 'redirection', plugin_dir_url( __FILE__ ).'admin.css', $this->version() ); |
Step2:
Open functions.php
file and enter below code:
1 2 3 4 5 |
add_action( 'wp_print_styles', 'deregister_my_styles', 100 ); function deregister_my_styles() { wp_deregister_style( 'redirection' ); } |