WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to remove a CSS from loading in the header, this is the code that appears:

<link rel='stylesheet' id='my-css'  href='http://test.tld/wp-content/themes/mytheme/my.css?ver=3.5' type='text/css' media='all' />

I tried using these functions but it didn't work:


Is there other ways that the above CSS line can be removed without manually editing it in the template?


share|improve this question
wpseek.com/wp_deregister_style – Anagio Feb 12 '13 at 4:59
up vote 4 down vote accepted

If your stylesheet is registered and enqueued correctly then...

function 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.



share|improve this answer
How about if the css loaded is from a child theme. How to remove them from within the parent theme only? – Emerson Maningo Feb 12 '13 at 5:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.