wp_dequeue_style not working

Okay so I figured this one out.

function custom_dequeue() {
    wp_dequeue_style('et-gf-open-sans');
    wp_deregister_style('et-gf-open-sans');

}

add_action( 'wp_enqueue_scripts', 'custom_dequeue', 9999 );
add_action( 'wp_head', 'custom_dequeue', 9999 );

@milo was right. The plugin was re-enqueueing it so the deregistering it got that file to stop loading.

Then the plugin also had another check, where it would register and enqueue another font with the same handle. The action was hooked into wp_head so I added my another action to wp_head and finally got it to stop loading completely!

Thanks for everyone’s help!

Leave a Comment