Remove ALL css for a specific plugin page

I’m now writing a plugin that hook with a [TAG] on a page. From now every thing work well except for the custom css. I’ve writing my plugin on a developement station with basic theme (20-14 I think). When I’ve put my plugin in the real site, that was very ugly because site theme css where not handle. There is a way to reset or remove all css in a plugin. I ask this because if one day I want to change my theme, I will have to rewrite my plugin to handle more theme css.
From now i’ve tries the hard way with wp_deregister_style(‘slug’).

add_action( 'wp_enqueue_scripts', 'my_scripts_method');


 function my_scripts_method() {    
//    wp_deregister_style('open-sans-css');
//    wp_deregister_style('rs-settings-css');
//    wp_deregister_style('rs-captions-css');
//    wp_deregister_style('rs-plugin-static-css');
//    wp_deregister_style('wp125style-css');
//    wp_deregister_style('u-design-reset-css');
//    wp_deregister_style('u-design-text-css');
//    wp_deregister_style('u-design-grid-960-css');
//    wp_deregister_style('u-design-superfish_menu-css');
//    wp_deregister_style('u-design-pretty_photo-css');
//    wp_deregister_style('u-design-style-css');
//    wp_deregister_style('u-design-custom-style-css');
//    wp_deregister_style('u-design-responsive-css');
//    wp_deregister_style('u-design-style-orig-css');
//and continue....

But it’s doesn’t work. Even if this work, I will have to completly re-begin if I change my theme. There is a way to put a reset css like or put everything to 0?

Read More

Sorry for my bad english, i’m french.

Francois

Related posts

2 comments

  1. You can try this function.

    function remove_all_theme_styles() {
        global $wp_styles;
        $wp_styles->queue = array();
    }
    add_action('wp_print_styles', 'remove_all_theme_styles', 100);
    

    This should work on any theme, but its not really a good approach to disable theme css just to make your plugin look good.

Comments are closed.