I have taken it upon myself to adhere to WordPress conventions so I can have a clean, sexy child theme. However, I am unsure how to proceed on a certain issue.

I would like to override the CSS for some plugins in my WordPress website, and this wonderful post was a great step in the right direction. My only concern is that I would like to do everything I can to avoid overriding the header.php file in my parent theme in order the do this.

Is there another wonderful way to do this? Thanks for your help!


As was pointed out by another user's comment, this is in fact dependent on how the plugin implements its styles. This aside, assume that the plugins do provide a way for styles to be implemented in the style.css sheet of the child theme, or, in my case, a separate styles folder linked to that style.css sheet.

I also know I can use !important all over the place, but this is generally frowned upon.

  • it depends entirely on how the plugins in question are adding their styles.
    – Milo
    May 28 '13 at 17:19
  • I updated my post to accomodate your comment. Thanks! May 28 '13 at 17:27
  • Close-voted as not constructive. Please edit your question to refer to specific Plugins, and include the specific CSS implementation code for those Plugins. May 28 '13 at 20:00
  • I would love to, but unfortunately this is a pretty general question. My goal is to encapsulate all stylesheets that add custom edits to any plugin's styling in a single folder in my child theme. This keeps some really clean code, and is very efficient. I will add specific, code, though! May 29 '13 at 16:58
  • I just found this Simple Custom CSS plugin It handles everything discussed for enqueuing dependent CSS. Simple to install and use.
    – user41251
    Sep 14 '14 at 19:25

If the plugins are correctly adding their styles via wp_enqueue_style, you simply need to dequeue them:

function wpa_dequeue_style() {
    wp_dequeue_style( 'plugin-style-handle' );
add_action( 'wp_enqueue_scripts', 'wpa_dequeue_style', 100 );

Whether or not this works depends on how and where the plugins are adding their styles, so there's no absolute answer without knowing specific methods the plugins in question use.

EDIT- another option that doesn't involve removing the styles entirely is to enqueue your own styles with the plugin styles as a dependency:

    get_template_directory_uri() . '/mystyles.css',
  • This is certainly a step in the right direction. However, my overrides are edits, so the trade-off of copy-pasting the entire stylesheet and editing it is a bit counter-productive. Like you said, it's also entirely dependent on how the css is added. May 28 '13 at 17:39
  • 3
    see edit above.
    – Milo
    May 28 '13 at 17:44
  • I'll give that edit a shot. That looks like a great idea! May 29 '13 at 16:58
  • 1
    Wow, I can't upvote enough. It worked! May 29 '13 at 19:20
  • It's an old answer but helped me in 2020. Thanks!
    – Kinburn101
    Jan 10 '20 at 4:46

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.