remove style/scripts defined within plugin class

Similar to this question WordPress – remove action defined within plugin class

i don’t want to remove the whole action, if they update something, it will be overwrite.

Read More

I just want to remove one style enqueued in the class-wc-admin-assets.php.
But the file it’s included inside a action with enclose.

So using this will not work:

function myFunctionToRemove(){
    wp_dequeue_style('jquery-ui-style');
    wp_deregister_style('jquery-ui-style');
}
add_action('admin_enqueue_scripts','myFunctionToRemove');

Is there a way to dequeue only one script?

The style that i want to dequeue it’s ‘jquery-ui-style’ on class-wc-admin-assets.php

Related posts

Leave a Reply

1 comment

  1. If the script is being enqueued on the admin_enqueue_scripts action you be able dequeue using your function, you likely just need to use a later priority.

    function myFunctionToRemove(){
        wp_dequeue_style('jquery-ui-style');
        wp_deregister_style('jquery-ui-style');
    }
    add_action( 'admin_enqueue_scripts','myFunctionToRemove', 11 );
    

    Try it with a priority of 11 and if that doesn’t work try 999.