Skip to content

theme.json governance at scale — central source of truth for distributed teams

theme.json starts simple. Once five teams edit block patterns and color tokens in parallel, it becomes the most-merged and most-broken file in the repo. The governance pattern that holds.

You inherit a WordPress codebase with one block theme and a single theme.json. Three months in, the design system team adds spacing tokens, the editorial team adds custom block patterns, the marketing team adds brand color presets, and an agency partner extends typography presets for a child theme. Every merge to theme.json now has conflicts, the design tokens drift from the Figma file they were derived from, and a junior dev silently removes a global settings.color.palette entry, breaking the brand color picker for half the editors. theme.json was not designed to be the schema for a multi-team design system. With governance, it can hold; without it, it becomes the most-broken file in your repo.

What’s happening

theme.json is a single declarative file that controls block editor settings, design token presets, block-level style defaults, and per-block style overrides. Its schema is hierarchical:

  • settings.* — what the editor allows (colors, fonts, spacing, layout widths, custom CSS access)
  • styles.* — what the front end renders by default (typography, colors, spacing applied globally)
  • styles.blocks.* — per-block overrides (the Group block has different padding than the Cover block)
  • styles.elements.* — element-level overrides (links, buttons, headings)
  • customTemplates and templateParts — registered template surfaces
  • patterns — registered block pattern slugs (pulled from the pattern directory or the theme’s /patterns folder)

WordPress merges three layers at runtime: core defaults, the active theme’s theme.json, and a theme.json shipped by any parent theme or block library plugin. User-level overrides (Global Styles in the editor) write to a separate database-stored layer (wp_global_styles_*). When the editor saves, it does NOT write back to the file — it writes to the database. This is the fact that breaks most governance schemes: the file is one source of truth, the database is another, and the two diverge silently every time an admin changes a global style in the UI.

The other thing that breaks is the merge model. theme.json arrays (color palettes, font families, font sizes) replace by default — they do not merge entry-by-entry. A child theme that defines settings.color.palette with three entries replaces the parent’s entire palette, not just adds three. Teams who do not know this delete tokens by accident every release.

How to verify

Audit the gap between the file and what the runtime actually applies:

# the merged, runtime-effective theme.json (what the editor sees)
wp eval 'echo wp_json_encode(WP_Theme_JSON_Resolver::get_merged_data()->get_raw_data(), JSON_PRETTY_PRINT);' > /tmp/merged-theme-json.json

# the file as committed
cp wp-content/themes/your-theme/theme.json /tmp/file-theme-json.json

# diff — anything that appears in merged but not the file is a database override or plugin contribution
diff <(jq -S . /tmp/file-theme-json.json) <(jq -S . /tmp/merged-theme-json.json) | head -80

To list user-level Global Styles overrides written by editors:

wp post list --post_type=wp_global_styles --post_status=publish --format=table
wp post get $(wp post list --post_type=wp_global_styles --post_status=publish --format=ids) --field=post_content

For block patterns, list what’s actually registered at runtime versus what the theme intends to ship:

wp eval 'foreach (WP_Block_Patterns_Registry::get_instance()->get_all_registered() as $p) { echo $p["name"] . " (" . ($p["source"] ?? "core") . ")\n"; }' \
  | sort -u

Patterns coming from source=core are pulled from the WordPress.org pattern directory and can disappear or change without warning. Patterns coming from source=theme live in your theme’s /patterns directory and are version-controlled.

The fix

The governance pattern that holds across distributed teams has four parts.

1. Treat theme.json as generated, not hand-edited. Source tokens live in a separate format (a YAML or JSON file that mirrors the design system, ideally exported from Figma or Style Dictionary). A build step compiles tokens + theme overrides into theme.json. Pull requests touch the source file, not the compiled artifact. The compiled file is committed for diffability, but no human edits it directly.

# repo structure
wp-content/themes/your-theme/
├── tokens/
│   ├── colors.yaml          # source of truth, mirrors Figma
│   ├── typography.yaml
│   ├── spacing.yaml
│   └── _build.js            # compiles to ../theme.json
├── patterns/                # one file per pattern, theme-owned
│   ├── hero-with-cta.php
│   └── three-column-grid.php
├── theme.json               # generated — do not edit by hand
└── package.json

The build script reads the YAML, normalizes the schema, and writes theme.json. A pre-commit hook runs the build and fails the commit if theme.json is stale relative to tokens/. This forces every change through the source-of-truth file.

2. Lock down user-level overrides where they would drift from brand. WordPress 6.6+ lets you disable specific Global Styles surfaces per role. For non-design users, disable the global color and typography overrides — let them use the theme’s presets, not invent new ones at the post level.

// functions.php — restrict Global Styles editor access to a 'designer' role
add_filter('block_editor_settings_all', function ($settings, $context) {
  if (!current_user_can('edit_theme_options') || !current_user_can('manage_design_system')) {
    $settings['__experimentalFeatures']['color']['custom'] = false;
    $settings['__experimentalFeatures']['color']['customGradient'] = false;
    $settings['__experimentalFeatures']['typography']['customFontSize'] = false;
  }
  return $settings;
}, 10, 2);

3. Pin pattern sources. Disable the WordPress.org pattern directory in production. Patterns must live in the theme. This prevents a community pattern from disappearing and breaking content that referenced it.

add_filter('should_load_remote_block_patterns', '__return_false');

Then version-control the /patterns directory and treat new patterns like any other code change — PR review, design QA, accessibility check.

4. Establish a token ownership map. Document which team owns which settings.* namespace. A single page in the team wiki:

NamespaceOwnerChange cadence
settings.color.paletteDesign systemQuarterly
settings.typography.*Design systemQuarterly
settings.spacing.*Design systemQuarterly
styles.blocks.core/groupEngineeringPer release
customTemplatesEngineeringPer release
patterns/*Editorial + EngWeekly

Changes to design-system-owned namespaces go through a design review. Changes to engineering-owned namespaces go through a code review. Changes to patterns can be lighter-weight but still need an editorial-engineering pair signing off.

For child themes (agency partners shipping a variant), use composer.json or a build step to pull design tokens from the parent and override only what’s explicitly delegated. Never let a child theme redefine the full palette — it will overwrite, not merge.


Stack Harbor designs the build pipeline, token governance, and editor restrictions for enterprise WordPress hosting installs running theme.json at scale. If your theme.json is the file with the most merge conflicts in your repo, we can audit the governance model and put a generated-artifact discipline in place.