Skip to main content
The theme.json file is a powerful configuration tool that controls the WordPress Block Editor’s behavior, appearance, and available features. You can use it to define global settings, customize block supports, and create a cohesive design system for your theme.

What is theme.json?

Theme.json is a JSON configuration file that allows you to:
  • Control which editor features are available to users
  • Define global design tokens (colors, typography, spacing)
  • Configure block-level settings and styles
  • Create a consistent design system across your site

Schema Structure

The theme.json file follows a versioned schema. Here’s the basic structure:
Always use "version": 3 for the latest schema. This ensures you have access to all current features.

Settings Configuration

Color Settings

You can define a custom color palette and control color-related features:

Typography Settings

Define font families, sizes, and typography controls:

Layout Settings

Control the default content width and layout options:
To disable the “Inherit default layout” setting for container blocks like the Group block, remove or set contentSize and wideSize to null.

Block-Level Settings

You can configure settings for specific blocks using the blocks key:

Limiting Editor Features

You can create a highly restricted editing experience by disabling most features:

Styles Configuration

Define global and block-specific styles:

CSS Custom Properties

Theme.json automatically generates CSS custom properties from your presets:
This generates the following CSS:

Common Use Cases

Curating the Editor Experience

Restrict editor features while maintaining design consistency:

Duotone Configuration

Provide predefined duotone filters:

Best Practices

  1. Start with a minimal configuration: Only define what you need to override
  2. Use meaningful slug names: Make them descriptive for better developer experience
  3. Test across blocks: Verify your settings work as expected across different block types
  4. Document your choices: Add comments (in your theme documentation) explaining why certain features are disabled
  5. Consider accessibility: Ensure your color combinations meet WCAG contrast requirements

Next Steps