Skip to content

Custom CSS conflicts in WordPress: a survival pattern

Custom CSS in WordPress lives in five different places, and theme updates can silently overwrite three of them. The survival pattern that keeps your CSS where you can find it.

Custom CSS in WordPress is the most-edited and least-tracked surface of the average site. Over a typical project’s lifetime, it accumulates in five different storage locations: the theme’s style.css, the child theme’s style.css, the Customizer’s “Additional CSS,” a CSS plugin like Simple Custom CSS, the page builder’s per-widget custom CSS, and (in some cases) inline <style> tags inside post content. When the theme updates, three of these get silently overwritten, and nobody can remember which CSS was supposed to do what. The survival pattern below keeps custom CSS findable, traceable, and update-proof.

What’s happening

WordPress provides multiple legitimate CSS surfaces because different audiences need different mechanisms. A developer wants CSS in the theme files versioned in git. An editor wants the Customizer’s “Additional CSS” panel that does not require code access. A page-builder user wants per-widget CSS that lives with the component. A plugin author wants their CSS in their plugin directory. Each of these is reasonable in isolation. The conflict is that they all enqueue at different priorities, override each other, and survive different update events differently. A theme update overwrites theme style.css, leaves child-theme style.css alone, and does not touch Customizer Additional CSS — but the visual result depends on which sheet had which selector with which specificity.

The result on the typical WordPress hosting client we audit: a 4000-line CSS pile across five locations, where 30% is dead code, 20% conflicts with itself, and the team is afraid to delete any of it because they cannot trace what each rule does.

How to verify

Audit all the CSS surfaces:

# 1. Theme stylesheet
wc -l wp-content/themes/$(wp theme list --status=active --field=name)/style.css

# 2. Child theme stylesheet (if any)
ls wp-content/themes/ | grep child
wc -l wp-content/themes/your-child-theme/style.css 2>/dev/null

# 3. Customizer Additional CSS
wp option get theme_mods_$(wp theme list --status=active --field=name) --format=json | jq -r '.custom_css_post_id' | xargs -I {} wp post get {} --field=post_content | wc -l

# 4. CSS plugins
wp plugin list | grep -iE 'custom-css|simple-css|css-hero'

# 5. Page builder per-page CSS — for each builder
wp db query "SELECT COUNT(*) FROM wp_postmeta WHERE meta_key='_elementor_data' AND meta_value LIKE '%custom_css%';" --skip-column-names

Then look at the rendered HTML for a representative page and count the <style> blocks emitted:

curl -s https://example.com/ -o /tmp/page.html
grep -c '<style' /tmp/page.html
grep -oE 'rel="stylesheet"[^>]*href="[^"]+"' /tmp/page.html | wc -l

A site with 8+ stylesheets and 12+ inline <style> blocks is past the point where ad-hoc CSS organization works. The fix is structural.

The fix

The survival pattern:

  1. Designate one canonical location per audience.

    • Developer CSS → child theme style.css (or, in block themes, the theme’s CSS file plus theme.json). Version-controlled.
    • Editor CSS → Customizer “Additional CSS.” Database-backed, survives theme updates.
    • Per-page or per-section visual tweaks → page builder’s per-widget CSS, scoped tightly.
    • Plugin-emitted CSS → leave it alone, do not override in the theme.
  2. Stop using the parent theme’s style.css for customizations. Any change you make there gets overwritten on update. If you have edits in parent theme CSS today, move them — child theme if structured, Customizer Additional CSS if isolated.

  3. Add a comment header to every custom CSS rule explaining what it does:

    /* Hide the breadcrumb on the homepage only — requested by marketing 2025-03 */
    .home .breadcrumb { display: none; }

    Six months from now, you (or someone else) will need this comment to know if the rule is still relevant.

  4. Audit and prune annually. Run a CSS coverage report in Chrome DevTools (more options → Coverage). Selectors that match nothing on any current page are candidates for removal. Do this once a year, after a theme update, before the team accumulates another quarter of additions.

  5. Document the cascade order. When you have CSS in three locations, write down which loads last and which specificity wins. The order in a typical site: theme style.css → child style.css → Customizer Additional CSS → page builder per-widget. Each later one overrides earlier ones at equal specificity.

  6. For complex sites, consolidate Customizer Additional CSS into the child theme periodically (annually). Customizer storage is database-backed, which is fine, but for sites that are version-controlled and deployed via CI, having CSS in the database creates an environment-drift surface. Move it to files when the team is ready. This is one of the recurring hygiene items in a enterprise WordPress operations quarterly review.

For WordPress sites where the CSS pile has grown past the point of unraveling alone, Stack Harbor runs CSS consolidation under WordPress operations and documents the canonical location going forward. Book a WordPress consult if your team is spending more time hunting rules than writing them.