How to remove CSS file in the header using WordPress functions?

If your stylesheet is registered and enqueued correctly then…

function dequeue_my_css() {
  wp_dequeue_style('my-css');
  wp_deregister_style('my-css');
}
add_action('wp_enqueue_scripts','dequeue_my_css');
// add a priority if you need it
// add_action('wp_enqueue_scripts','dequeue_my_css',100);

… should remove it. That only works if the stylesheet was registered and/or enqueued with wp_register_style and wp_enqueue_style.

If it is not registered correctly then you will have to figure out what your theme did and undo that. It may require editing the template, depending on how the theme is written.

http://codex.wordpress.org/Function_Reference/wp_dequeue_style

http://codex.wordpress.org/Function_Reference/wp_deregister_style

Leave a Comment