---
title: "Why WordPress custom CSS disappears when you switch themes"
description: "Additional CSS belongs to the theme, so it disappears when you switch. Where WordPress keeps custom CSS, why it vanishes, and how to keep styles theme-proof."
pubDate: 2026-09-22
source: https://adminkeep.com/guides/wordpress-custom-css/
---

You spend an afternoon getting the site right. The header border is thinner, links have a proper underline, the buttons have softer corners, the site title stops wrapping on phones. Months later you try a new theme, and every one of those tweaks is gone. Switch back, and they return.

Nothing was deleted. Your custom CSS was saved in a place that belongs to the old theme, and WordPress only loads it while that theme is active. Most places you can add custom CSS in WordPress work this way, and it is rarely explained up front.

This guide covers where WordPress custom CSS can live, which of those places are tied to a theme, and how to keep site-wide styles that stay put whatever theme you run.

## Where custom CSS can live in WordPress

There are four common homes for custom CSS, and they differ in one way that matters here: what they are attached to.

**The Customizer's Additional CSS.** On a classic theme, **Appearance → Customize → Additional CSS** is the box most people find first. WordPress stores what you type there as a post of its own, of the `custom_css` type, one for each theme, keyed to the theme's stylesheet (its folder name). Only the post belonging to the active theme is printed on the page.

**Styles → Additional CSS in the Site Editor.** On a block theme, such as Twenty Twenty-Five, the Customizer usually no longer appears in the Appearance menu. The CSS box moved into the Site Editor: **Appearance → Editor → Styles**, then Additional CSS. What you type there is saved in your global style changes for that theme, which WordPress also keeps per theme.

**A child theme's `style.css`.** A child theme is a small theme that inherits everything from a parent and adds its own files. CSS in its stylesheet survives updates to the parent, which is what child themes are for. But it only loads while that child theme is the active theme, so moving to a different theme leaves it behind.

**A plugin.** CSS stored by a plugin belongs to the plugin, not to the theme. As long as the plugin is active, it can print the CSS on every theme.

| Where | Tied to | Survives a theme switch |
|---|---|---|
| Customizer → Additional CSS | The theme that was active when you saved it | No |
| Site Editor → Styles → Additional CSS | The block theme's global styles | No |
| Child theme `style.css` | The child theme | No |
| A plugin | The plugin | Yes, while the plugin is active |

## Why custom CSS disappears when you switch themes

WordPress treats Additional CSS as part of a theme's look, next to its colours, header image and layout choices. That makes sense for rules written against one theme's markup: CSS that fixes a gap under one theme's header means nothing to another theme, and could break it.

But a lot of custom CSS is not like that. Link underlines, button corners, a brand colour on selected text, a readable font size on phones: these belong to the site, and you want them on any theme. WordPress has no separate box for that kind of CSS, so it goes in the theme's box and leaves with the theme.

The old CSS is still in the database. Switch back to the old theme and it comes back. What WordPress doesn't do is carry it across to the new one, or tell you it stayed behind. The usual fix is to copy it by hand before switching, and remember to do that every time.

The same goes for a redesign that moves from a classic theme to a block theme. The CSS box moves from the Customizer to the Site Editor, and the CSS you wrote in the Customizer stays with the old theme.

## Site-wide CSS with Adminkeep

[Adminkeep](https://wordpress.org/plugins/adminkeep/) is a free plugin made of small features that each have one switch. Its Custom CSS feature works as a standalone [custom CSS plugin](/custom-css/): it gives your site one stylesheet that belongs to the site rather than to a theme.

1. Go to **Settings → Adminkeep** and switch on **Custom CSS** in the **Appearance** group. If you don't have the plugin yet, [installation](/docs/installation/) takes a minute.
2. Open **Appearance → Custom CSS**. It sits in the Appearance menu on classic and block themes alike, not several clicks deep in the Site Editor.
3. Add your custom CSS and press **Save CSS**.

The editor is WordPress's own code editor, the one core uses for its CSS box, with line numbers, syntax highlighting and CSS linting that flags mistakes as you type. If you have switched syntax highlighting off in your user profile, you get a plain text box instead.

<figure class="ak-shot">
  <img src="/screenshots/custom-css-editor.webp" alt="Custom CSS screen under Appearance with a code editor for site-wide CSS" width="1200" height="613" loading="lazy" decoding="async" />
  <figcaption>Appearance → Custom CSS: one stylesheet for the site, whatever the theme.</figcaption>
</figure>

What it does once saved:

- **It prints on every theme.** The CSS is kept in a site option, not in a theme, and printed in the head of every front-end page, whichever theme is active. Switch themes and it is still there.
- **Your theme's own Additional CSS is left alone.** Adminkeep doesn't move, copy or change it, and you can keep using both. Adminkeep's CSS is printed after the Customizer's Additional CSS, so when the two set the same property with equally specific selectors, the site-wide rule wins.
- **It styles the front end only.** It isn't loaded in the admin or inside the block editor, so the editor won't preview it; check the result on the site itself.
- **HTML is refused.** Anything that looks like an HTML tag is rejected when you save, with a message saying so and your text kept on screen to fix. A pasted snippet can't slip a `<script>` tag into the page.
- **Only administrators can edit it.** The screen needs the same two permissions that guard WordPress's own Additional CSS box, so editors don't see the menu item. On a multisite network, only super admins can use it.

Switching the feature off stops the CSS printing and removes the menu item. The CSS itself is kept, so switching it back on brings it back. It is deleted only when you uninstall the plugin.

## A few safe starting rules

Rules that belong in site-wide CSS are the ones that should look the same on any theme. These three use plain selectors most themes share. Adjust the numbers to taste.

Give links a clearer underline, set a little below the text so it doesn't cut through letters:

```css
.entry-content a {
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}
```

Soften the corners of buttons made with the Buttons block:

```css
.wp-block-button__link {
	border-radius: 6px;
}
```

Stop a long site title from taking over a phone screen:

```css
@media (max-width: 600px) {
	.site-title {
		font-size: 1.25rem;
	}
}
```

Class names like `.site-title` and `.entry-content` are common, not universal. If a rule does nothing after a theme switch, right-click the element, choose **Inspect**, and see what the new theme calls it. Adding a second selector for the new theme is usually all it takes.

## From the command line

If you manage sites with [WP-CLI](https://wp-cli.org/), the same CSS is available there. Switch the feature on first:

```bash
wp adminkeep feature enable custom_css
```

Print the stored CSS, and nothing else, so it can be saved straight to a file:

```bash
wp adminkeep css get > site.css
```

Replace it from a file, or from standard input when you leave the file out:

```bash
wp adminkeep css set site.css
cat site.css | wp adminkeep css set
```

`css set` checks for HTML the same way the screen does, and replaces the stored CSS in full rather than adding to it. Setting empty CSS clears it; if CSS is already stored, you're asked to confirm first, and `--yes` skips the question. If the feature is off, the CSS is still saved, and the command reminds you to switch it on before it prints.

That makes it simple to keep one stylesheet in version control, or to copy it from one site to the next. The [WP-CLI docs](/docs/wp-cli/) list every Adminkeep command.