How To Disable Plugin StyleSheet In WordPress Blog

Posted by

Hi,

When you activate any plugins, it will automatically ads their css stylesheet to your WordPress blog style file. It is a cleaner to have all your css styles in one stylesheet. But if we want use our default style then we need to  stop to add plugin stylesheet in blog stylesheet file.

To stiop that first you need to open the plugin file and find the code which include a plugin-specific stylesheet in the blog header. This function is called wp_enqueue_style(). It should be like this:

wp_enqueue_style(‘wp-pagenavi’, get_stylesheet_directory_uri().’/pagenavi-css.css’, false, ‘2.50’, ‘all’);

What we need to find is the handle which is the first argument of the wp_enqueue_style() function. In the previous example, wp-pagenavi is the handle we need. Once done, open your functions.php file and paste the following code in it:

add_action( ‘wp_print_styles’, ‘my_deregister_styles’, 100 );

function my_deregister_styles() {
wp_deregister_style( ‘wp-pagenavi’ );
// deregister as many stylesheets as you need…
}

That’s it!

Thanks,

Shane G.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.