How To Remove All Other Plugins CSS

Question

I install my plugin at old test site and got design problem because of css from other plugins. I try this code to remove all of them but it removes a few only:

function remove_all_theme_styles() {
    global $wp_styles;
    $wp_styles->queue = array();
    foreach ( $wp_styles->queue as $style ) :
        if ( 'idcrm-contacts' !== $style && 'monster-style' !== $style ) {
            wp_deregister_style( $style );
            wp_dequeue_style( $style );
        }
        endforeach;
}

    add_action( 'wp_print_styles', 'remove_all_theme_styles', 999 );

I try var_dump and doesn’t see all other css but I see it in page code. I think maybe these css loads after my plugin and looking for answer how tou use my code in the end off all loadings.

0
Megos 3 weeks 2021-12-25T17:08:30-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse