The introduction of theme.json in WordPress has revolutionized theme development, offering developers more control with less code. One of its powerful components is the blocks
property. This feature allows for precise, block-specific style settings, significantly enhancing the customizability and maintainability of themes.
Before the advent of theme.json
, developers had to rely heavily on custom CSS and PHP functions to control block behavior and styling. Now, through a centralized configuration file, theme developers can globally or specifically modify block settings with ease.
What Is the blocks
Property?
The blocks
property in theme.json is designed to target individual core or custom blocks and apply styles, settings, and layout configurations to them. Each block is defined using its namespace (usually core
), followed by the block name, like core/paragraph
or core/image
.

This property enables developers to:
- Define block-level defaults for typography, color, and spacing
- Override global settings for specific blocks
- Streamline user-facing customization through the site editor
How It Works
Here’s an example of a simple blocks
configuration inside theme.json
:
{ "version": 2, "settings": { "blocks": { "core/paragraph": { "typography": { "fontSize": "18px", "lineHeight": "1.8" }, "color": { "text": "#333333", "background": "#f0f0f0" }, "spacing": { "margin": "1em 0" } } } } }
In this example, paragraph blocks will consistently render with an 18px font size, a light background color, and consistent margins—all defined in one place.
Why It’s Crucial for Theme Developers
Understanding and leveraging the blocks
property is essential for several reasons:
- Consistency Across Themes: Developers can ensure that all instances of a given block behave in a predictable manner throughout the site.
- Cleaner Codebase: Fewer style overrides are needed in external CSS files, reducing bloat and potential for conflicts.
- Enhanced Block Customization: The property allows complete control over block appearance without modifying the block’s PHP or JavaScript files.
Best Practices When Using the blocks
Property
Here are some recommended practices to make the most of the blocks
configuration:
- Follow a naming convention: Always use the correct block namespace to avoid errors (e.g.,
core/heading
). - Use defaults effectively: Set global styles under the
settings
key and only override them inblocks
when necessary. - Test in both the editor and frontend: Ensure that changes render properly in both the block editor and the live site.
Advanced Use Cases
The blocks
property also supports more advanced options, such as enabling or disabling specific controls for each block. For example, you can limit font family choices or disable custom spacing:
"core/heading": { "typography": { "fontFamilies": [ { "fontFamily": "Arial, sans-serif", "slug": "arial", "name": "Arial" } ], "customFontSize": false } }
This is particularly useful when creating themes for clients, where consistency and simplicity can be more valuable than full editing freedom.

Staying Up-to-Date
As WordPress continues to evolve with Full Site Editing (FSE), the theme.json
file—and specifically the blocks
property—will likely gain additional capabilities. Developers should keep an eye on the official WordPress development channels and changelogs. New block types and updated block settings are regularly added, offering even more ways to streamline your themes.
Conclusion
The blocks
property in theme.json
is a game-changer for WordPress theme developers. It centralizes configuration, promotes styling consistency, and reduces the need for custom CSS and PHP tweaks. By mastering this property, developers can deliver highly customizable yet maintainable themes and provide a better experience for end users and clients alike.
I’m Sophia, a front-end developer with a passion for JavaScript frameworks. I enjoy sharing tips and tricks for modern web development.