By William Lopez Updated (published )
WordPress theme.json Explained: Settings, Styles, Cascade
Understand why settings and styles do different jobs in theme.json, and fix block theme edits that render nothing by working through the WordPress cascade.
- Topic
- Themes
- Free tool for this
- WordPress theme.json Generator
- Sources
- 7 linked at the end
theme.json is a single configuration file at the root of a block theme that does two separate jobs: settings decides what the block editor offers users, and styles decides what the site actually looks like by default. WordPress parses it, merges it with its own defaults and with anything saved in the Site Editor, and outputs the result as CSS custom properties plus an inline stylesheet on every page.
Confusing those two jobs makes a theme.json edit look as if it did nothing. Declaring a color under settings does not apply that color anywhere. It only creates a variable and a swatch in the editor sidebar.
TL;DR: presets under settings only generate CSS variables, classes and editor controls; styles is what applies a value. The one exception is the layout widths in settings.layout, which constrained layouts apply on their own. If a theme.json edit “does nothing,” check in this order: (1) you edited settings and forgot styles, (2) a saved Global Styles record in the database is overriding your file, or (3) a page cache or CDN is still serving the old HTML. The diagnostic order below walks through all three. If you’d rather not hand-write the JSON, the theme.json generator builds a valid file from a form and shows you the output.
The top-level keys
A minimal file looks like this:
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"settings": {},
"styles": {},
"templateParts": [],
"customTemplates": []
}| Key | What it does |
|---|---|
$schema | Editor autocomplete and validation only. WordPress ignores it. |
version | Tells WordPress which schema shape to parse. Not your theme version. |
settings | Generates CSS variables and controls what the editor exposes. |
styles | Applies actual default styling. |
templateParts | Declares parts in parts/ and which area they belong to. |
customTemplates | Gives templates in templates/ a title and the post types that offer them. |
version trips people up because it looks like a theme version number. It is not. It selects a parsing mode, and older WordPress releases silently ignore keys from a schema shape they do not know. If you support older installs, target the version those installs understand rather than assuming newer keys degrade gracefully. Version 3 is current at the time of writing; version 2 is still widely deployed and still parsed. Current WordPress migrates a version 1 or 2 file to version 3 as it reads it. A file with no version key at all is replaced by an empty one, so none of its settings or styles apply (both read from the WordPress 7.1.4 source, not run).
$schema points at a schema URL hosted by WordPress. Pinning it to trunk gives you the newest hints in your code editor; a version-specific URL is safer if you are deliberately staying on an older schema.
settings: what the editor offers
Presets under settings produce CSS custom properties, and most keys add or remove a control in the editor. A preset styles nothing by itself.
Layout is the exception. settings.layout.contentSize and wideSize become --wp--style--global--content-size and --wp--style--global--wide-size. Blocks inside a container with a constrained layout, such as a Group set to constrained, get those values as their max-width with no styles entry at all (read from the WordPress 7.1.4 source, not run).
{
"settings": {
"color": {
"palette": [
{ "slug": "base", "color": "#ffffff", "name": "Base" },
{ "slug": "brand", "color": "#1f4ed8", "name": "Brand" },
{ "slug": "ink", "color": "#111827", "name": "Ink" }
],
"custom": false
},
"typography": {
"fontSizes": [
{ "slug": "small", "size": "0.875rem", "name": "Small" },
{ "slug": "large", "size": "1.5rem", "name": "Large" }
]
},
"layout": {
"contentSize": "680px",
"wideSize": "1200px"
}
}
}That produces variables named from the preset path and slug:
--wp--preset--color--base
--wp--preset--color--brand
--wp--preset--color--ink
--wp--preset--font-size--small
--wp--preset--font-size--largeColors also produce utility classes such as .has-brand-color and .has-brand-background-color, which is how the editor applies a picked swatch to a block. Not every preset gets a class, as the table below shows.
The "custom": false line is the other half of settings: turning options off. Set it and the arbitrary color picker disappears, leaving users your palette and nothing else. The same pattern works across the board: settings.typography.customFontSize, settings.spacing.customSpacingSize, settings.border, and so on. Most keys add a variable, add a control, or remove a control.
Here is the same transformation laid out as input-to-output, since the naming pattern is the part people get wrong. The class column comes from the preset list in WordPress 7.1.4’s WP_Theme_JSON class, and we checked it against the stylesheet a Twenty Twenty-Five site printed on 2026-11-16:
You write under settings | Variable WordPress generates | Utility classes generated |
|---|---|---|
color.palette entry, slug brand | --wp--preset--color--brand | .has-brand-color, .has-brand-background-color, .has-brand-border-color |
color.gradients entry, slug sunset | --wp--preset--gradient--sunset | .has-sunset-gradient-background |
typography.fontSizes entry, slug large | --wp--preset--font-size--large | .has-large-font-size |
typography.fontFamilies entry, slug body | --wp--preset--font-family--body | .has-body-font-family |
spacing.spacingSizes entry, slug 40 | --wp--preset--spacing--40 | None; reference it in styles |
shadow.presets entry, slug soft | --wp--preset--shadow--soft | None |
dimensions.aspectRatios, border.radiusSizes, dimensions.dimensionSizes | --wp--preset--aspect-ratio--…, --wp--preset--border-radius--…, --wp--preset--dimension--… | None |
custom.lineHeight.body | --wp--custom--line-height--body | None; custom never generates classes |
So colors, gradients, font sizes and font families get classes. Spacing, shadows, aspect ratios, radius and dimension presets only get a variable, and settings.custom always produces a variable only. You reference those yourself under styles, exactly like the brand-color example above.
settings.custom is a free-form bucket for your own variables:
{
"settings": {
"custom": {
"lineHeight": { "body": 1.6 },
"shadow": { "card": "0 1px 3px rgba(0,0,0,0.12)" }
}
}
}Those become --wp--custom--line-height--body and --wp--custom--shadow--card. Note the transformation: camelCase keys are split into kebab-case, and nesting is joined with double dashes. Getting a variable name wrong is a common reason a value silently falls back.
You can scope settings per block, which is how you allow a color picker on buttons but not on paragraphs:
{
"settings": {
"blocks": {
"core/paragraph": {
"color": { "custom": false, "customGradient": false }
}
}
}
}styles: what actually renders
styles is where values get applied. It mirrors the editor’s structure: a root level, then elements, then blocks.
{
"styles": {
"color": {
"background": "var(--wp--preset--color--base)",
"text": "var(--wp--preset--color--ink)"
},
"typography": {
"lineHeight": "var(--wp--custom--line-height--body)"
},
"elements": {
"link": {
"color": { "text": "var(--wp--preset--color--brand)" },
":hover": { "typography": { "textDecoration": "none" } }
}
},
"blocks": {
"core/quote": {
"typography": { "fontStyle": "italic" },
"spacing": { "padding": { "left": "var(--wp--preset--spacing--40)" } }
}
}
}
}Root-level styles land on the body. elements covers HTML primitives that are not blocks: link, button, headings, caption. blocks targets a specific block type by name.
Inside styles you can also write a preset reference in a shorter form, var:preset|color|brand, which WordPress turns into var(--wp--preset--color--brand) when it builds the stylesheet. (That conversion is read from the WordPress 7.1.4 source, not run here.)
The honest limitation: styles cannot express everything CSS can. The supported states are a short list. Under elements, link and button accept :link, :any-link, :visited, :hover, :focus, :focus-visible and :active. Since WordPress 7.0, the Button and Navigation Link blocks accept :hover, :focus, :focus-visible and :active under styles.blocks. WordPress 7.1 adds two breakpoint states, @mobile (480px and below by default) and @tablet (above 480px, up to 782px), with the sizes set in settings.viewport. It also adds a -current state for the Navigation Link block, which targets the menu item for the page being viewed. That list is read from the WordPress 7.1.4 source and was not run here. Beyond it, there is no way to author your own media queries, no complex selectors and no animations. Fluid typography and layout-based sizing cover a lot of what people used breakpoints for, but not all of it. Most shipping block themes carry theme.json plus a modest stylesheet, and that is a normal outcome, not a failure.
The settings-versus-styles trap
Say you add a brand color and nothing changes on the site. That is expected. Adding it to settings.color.palette created --wp--preset--color--brand and a swatch. It applied nothing. To make it the default link color you must also write it under styles:
{
"settings": {
"color": {
"palette": [{ "slug": "brand", "color": "#1f4ed8", "name": "Brand" }]
}
},
"styles": {
"elements": {
"link": { "color": { "text": "var(--wp--preset--color--brand)" } }
}
}
}Read it as: settings is the box of paint you hand the user, styles is the coat you put on before they arrive.
A second version of the same mistake, scoped to spacing instead of color: you add a value under settings.spacing.spacingSizes with slug 40, and the editor’s spacing control now offers it. But no block uses it by default, because, per the reference table above, a spacing preset never generates a utility class the way a color preset does. You have to write "padding": { "left": "var(--wp--preset--spacing--40)" } under styles.blocks.core/quote (or wherever you want it) yourself, exactly as the core/quote example earlier in this guide does. The fix is identical in shape every time: the preset only names the value, styles is what assigns it somewhere.
The cascade, lowest to highest
This is the part that explains a site that “ignores” the theme file. WordPress merges several layers before emitting CSS:
- WordPress core defaults. Core ships its own
theme.jsonwith a baseline palette, font sizes and spacing scale. - Block defaults. Styles that core and plugin blocks declare for themselves in their
block.json. - Parent theme
theme.json - Child theme
theme.json, merged over the parent’s. - Global Styles saved in the database. What the Site Editor’s Styles panel writes.
- Per-block styles on individual blocks. Attributes stored in post content, rendered as inline styles or classes.
WordPress’s own code names layers 1 to 5 as four origins: default, blocks, theme (parent and child merged) and custom, each overriding the one before. Layer 6 is not part of theme.json at all; it is the block’s own markup.

The Global Styles layer (5 in the list, 4 in the diagram, which leaves out block defaults) is the one that breaks sites. The moment anyone opens the Styles panel and saves, WordPress stores a Global Styles record and that record wins over your file for every property it contains. Editing theme.json afterwards changes nothing visible for those properties, on a site that looks identical after a deploy while the file on disk is obviously different.
The fix is to clear the saved record, not to escalate with !important. Open the Site Editor and go to Styles. In the panel’s More menu (the three dots), choose Reset styles, then save. The other route is the Revisions button: pick Default styles at the bottom of the list, press Reset to defaults, then save. (Those control names are read from the WordPress 7.1.4 editor script, not clicked in our test.) Confirm with the client or site owner first, because resetting discards their customizations, which is a real cost, not a free action.
The same database-over-file rule explains a block template that refuses to apply. There the saved copy is a wp_template post rather than a Global Styles record, but it beats the file in the same way.
The second suspect is caching, but usually not WordPress’s own. WordPress keeps the parsed theme.json data in a cache group that is not persistent, so it lasts only for the current request even when Redis or Memcached is installed. The block stylesheet it stores between requests is keyed by a hash of the merged data, so a changed file produces a new one. Both details are read from the WordPress 7.1.4 source. We checked the result on 2026-11-16 in WordPress Playground (WordPress 7.1.4, PHP 8.3, WP_DEBUG off, no development mode): after we changed a child theme’s brand color in theme.json, the very next page request carried the new value.
WP_DEBUG plays no part in this. The setting that makes WordPress skip its theme caches is define( 'WP_DEVELOPMENT_MODE', 'theme' ); in wp-config.php (or 'all'), which is meant for sites where you are building the theme. If your edits still appear late, look at a page cache plugin, your host’s cache or a CDN, which can keep serving old HTML with the old inline styles.
templateParts and customTemplates
Both are arrays that describe files already sitting in your theme.
{
"templateParts": [
{ "name": "header", "title": "Header", "area": "header" },
{ "name": "footer", "title": "Footer", "area": "footer" }
],
"customTemplates": [
{ "name": "page-wide", "title": "Wide Page", "postTypes": ["page"] }
]
}name matches the filename without its extension: parts/header.html, templates/page-wide.html. Which template file WordPress picks for each request is a separate question, mapped out in the block theme template hierarchy reference.
The area value decides which group the editor files the part under and, unless the template says otherwise, which element wraps it. WordPress 7.1.4 knows four areas: header (wrapped in <header>), footer (<footer>), navigation-overlay and uncategorized, which the editor shows as General (both wrapped in <div>). Plugins can add more through the default_wp_template_part_areas filter. Any other value, including a typo or sidebar, is stored as uncategorized. WordPress does log a notice when that happens, but it only shows with WP_DEBUG on. In our 2026-11-16 Playground test, "area": "sidebar" produced "sidebar" is not a supported wp_template_part area value and has been added as "uncategorized". and the same part with "area": "header" produced no notice.
The wrapper element has one more rule: a tagName set on the template part block inside the template wins over the area. So a header part that renders as a plain <div> usually means a misspelled area and a template part block with no tagName, not a missing template part.
customTemplates gives a template a readable title and limits which post types offer it. A template does not need an entry to be selectable. Any file in templates/ whose name is not one of core’s default template types (such as single, page, archive or 404) shows in the post editor’s Template panel for every public post type, titled with its file name minus .html. An entry with no postTypes limits the template to pages (all read from the WordPress 7.1.4 source, not run).
theme.json is not only for block themes. A classic theme that ships one gets the same global styles and presets: WordPress only checks that the file exists. In our test, adding a theme.json to a classic theme also turned its Appearance → Patterns menu item into Appearance → Design. If you are not sure which kind of theme a site runs, see block theme vs. classic theme first. A classic child theme’s stylesheet still loads through the enqueue mechanics covered in why a child theme’s styles stop loading.
Style variations
A block theme can ship alternative looks as extra JSON files in a styles/ folder at the theme root. Each file uses the same shape as theme.json, and the Site Editor offers them under Styles. The title field is optional; WordPress falls back to the file name. When someone picks a variation and saves, it is stored as their Global Styles, so it lands in the Global Styles layer of the cascade above and beats your theme.json the same way any saved Styles change does.
A quick diagnostic order
When a block theme is not styling the way the file says it should, work through this before touching anything:
- View source and search for the generated global styles block. If your variable is not there, the problem is in
settingsor a slug typo. - If the variable exists but is unused, the problem is a missing
stylesentry. - If both exist but something overrides them, check for a saved Global Styles record.
- Only then look at your own stylesheet, plugins, or a page builder injecting CSS later in the cascade, and at any page cache or CDN in front of the site.
Sources
- WordPress Theme Handbook: Global settings and styles (theme.json), Settings, Styles
- WordPress Theme Handbook: Style Variations
- WordPress Developer Resources: wp_get_development_mode()
- Block Editor Handbook: theme.json reference
- Gutenberg source code: theme.json schema
William Lopez runs Odie Themes, which publishes the free WordPress tools, themes and guides on this site.
Questions
What is theme.json in WordPress?
It is a single JSON configuration file at the root of a theme, usually a block theme, that controls two things: which design options the block editor exposes to users, and what the default styles are. WordPress reads it, generates CSS custom properties and a stylesheet from it, and merges it with core defaults, block defaults and any Global Styles the user saved.
What is the difference between settings and styles in theme.json?
Settings defines what is available and generates CSS variables plus editor controls. A preset there applies nothing on its own. The exception is layout: the content and wide widths under settings.layout become the max-width of blocks inside a constrained layout. Styles applies actual values using those variables. Adding a color to the palette does not change any element until you also reference it under styles or a user picks it in the editor.
Why are my theme.json changes not showing on the front end?
Check three things in order: an edit under settings with no matching styles entry, Global Styles saved in the database, and a page cache or CDN. A save in the Site Editor's Styles panel wins over theme.json for every property it contains. Choose Reset styles in the Styles panel's More menu, then save. If nothing was saved, suspect a cache: WordPress showed a theme.json edit on the next request in our test.
Do I still need a style.css file with theme.json?
Yes. WordPress requires style.css for the theme header comment that supplies the theme name, version and other metadata, so the theme is recognized at all. You can leave it otherwise empty and put your design decisions in theme.json, or keep a small amount of CSS for things theme.json cannot express.
What version number should theme.json use?
Use the highest version your minimum supported WordPress release understands. The version key tells WordPress which schema shape to parse, and older WordPress releases ignore keys they do not recognize. If you target older installs, stay on the version they support rather than assuming newer keys degrade gracefully.
Does theme.json replace CSS entirely?
No. It covers presets, block defaults, element styles, layout widths and spacing well. It supports a few states, such as :hover on links and buttons, and since WordPress 7.1 two breakpoints, @mobile and @tablet. It has no media queries you author yourself, no complex selectors and no animations, so most production block themes ship theme.json plus a modest stylesheet.