I am using the theme twentyten as a parent theme for my child theme. I have other stylesheets I want to use and so I'm trying to figure out how to wp_deregister_style for the style.css sheet that is printed out in the head section of the html.

I have checked the global $wp_styles variable around the shutdown hook and I see the other styles but not style.css - how can I get my child theme to stop using it?

I realize the theme name and info has to be stored here - I don't want to delete it, I just don't want it to be enqueued

  • do you have the line @import url("../twentyten/style.css"); in style.css of the child theme? - then remove it.
    – Michael
    Jan 25, 2012 at 21:19
  • Are you trying to remove the parent or the child CSS?
    – mor7ifer
    Jan 25, 2012 at 21:23
  • trying to remove all linked styles from showing up in the head - that's anything like <link rel="stylesheet" src="..." />
    – cwd
    Jan 25, 2012 at 21:44

2 Answers 2


Twentyten has a header.php file which has the style.css hardcoded into it:

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

There is no way to wp_dequeue_style because it is never "loaded" with wp_enqueue_style in the first place.

To get that out of the header you'll need to edit the twentyten theme (bad idea) or copy the header.php file over to your child theme so that it will override the original one and edit the file there (better idea), or as you mentioned, use a different base theme which does not have the style.css file hard coded into the header.php file, or if you will be using another stylesheet, use add_filter() to override what stylesheet_uri() returns with the new file (best idea).


Usage: <?php get_stylesheet_uri() ?>

  • Uses: apply_filters() Calls 'stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
  • Uses: get_stylesheet_directory_uri()

From http://codex.wordpress.org/Function_Reference/get_stylesheet_uri:

  • You don't need to remove that stylesheet link. Just don't put any styles in the stylesheet. You're already using a Child Theme, so you have absolute control over the content of the Child Theme's style.css content. Jan 26, 2012 at 4:03
  • if it is empty then you should get rid of it. it's an extra HTTP request (check out yslow) and there is in fact no reason for it to be loaded. plus if you enqueue a style you can specify a version number to help flush old styles when a new version of the css is available - something that you can't do with the hard-coded <style> tag. overall removing the hard-coded stylesheet is a good idea.
    – mark
    Jan 26, 2012 at 4:13
  • That's a separate issue from what the question is asking; namely; how to override the Parent Theme's CSS. Jan 26, 2012 at 4:16

Why don't you replace the contents of the style.css in your child theme with the contents of the stylesheets you have? The style.css in your child theme will replace the parent's stylesheet.

  • 2
    When using a Child Theme, the Child Theme's stylesheet is loaded by the header when <?php get_stylesheet(); ?> is called. The Parent Theme's stylesheet is never loaded when the Child Theme is in use. That's why, in order to port the Parent Theme's styles into the Child Theme, the Child Theme style.css calls @import() to include the Parent Theme's style.css. Jan 25, 2012 at 21:28
  • -1 - sorry @Stephen Harris, you're missing the point. I want to keep the styles from being printed in the <head> in the first place. all of the. i'm going to be using lesscss.org with this theme.
    – cwd
    Jan 25, 2012 at 21:45
  • @ChipBennett - you're on the right track here. if you post that i will accept the answer. I missed that the stylesheet was hard coded into the <head> of the parent theme. guess i should upgrade to twentyeleven because i think all the scripts should really be enqueued and then printed with with wp_head.
    – cwd
    Jan 25, 2012 at 21:48
  • @cwd my comment is simply a clarification of StephenHarris' answer; I consider his to be correct. He's saying the same thing I am, just in a different way (which is why I offered a clarifying comment). Jan 26, 2012 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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