Check and dequeue if multiple stylesheets exists using wp_style_is?

I need to dequeue styes for 3 plugins that load the same font stylesheet so i come up with the following function that of course not working:

add_action('wp_enqueue_scripts', 'dequeue_by_handles', 999);
function dequeue_by_handles() {
    $handle = array(
        'fontawesome',
        'font-awesome',
        'font-awesome-style'
        );

    if( wp_style_is( $handle, $list = 'enqueued' ) ) {
        wp_dequeue_style( $handle );
    }
}

Please note that firstly I need to check if a stylesheet handle exist then dequeue it.

Thank you.

Solutions Collecting From Web of "Check and dequeue if multiple stylesheets exists using wp_style_is?"

I have not tested this, but I imagine it is because you are passing an array to the $handle variable in your wp_style_is() function and not a string.

Maybe try looping through the array so you pass it a single string to check against each time.

Something Like this…

add_action('wp_enqueue_scripts', 'dequeue_by_handles', 999);

function dequeue_by_handles() {

    $handles = array(
        'fontawesome',
        'font-awesome',
        'font-awesome-style'
        );

    foreach ($handles as $handle) {

        if ( wp_style_is( $handle, $list = 'enqueued' ) ) {
            wp_dequeue_style( $handle );
        }
    }
}