# Locking down a client's block theme with theme.json and template locks


A common complaint after a WordPress launch: "The client changed the heading font in the editor and now every page looks different." With block themes this is avoidable. WordPress gives you three layers of control, `theme.json` settings, block locking and pattern design, and together they let editors change content without changing the design system.

This is how we set those layers on business sites for clients in the US, UK, Canada and Australia.

## Layer 1: restrict design tools in theme.json

`theme.json` decides which controls the editor shows. Anything you don't enable, editors can't use. Start strict and open up only what the brand needs.

```json
{
  "$schema": "https://schemas.wp.org/trunk/theme.json",
  "version": 3,
  "settings": {
    "appearanceTools": false,
    "color": {
      "custom": false,
      "customGradient": false,
      "defaultPalette": false,
      "defaultGradients": false,
      "palette": [
        { "slug": "brand", "color": "#1d4ed8", "name": "Brand" },
        { "slug": "ink", "color": "#111827", "name": "Ink" },
        { "slug": "paper", "color": "#ffffff", "name": "Paper" }
      ]
    },
    "typography": {
      "customFontSize": false,
      "fontSizes": [
        { "slug": "small", "size": "0.875rem", "name": "Small" },
        { "slug": "medium", "size": "1rem", "name": "Medium" },
        { "slug": "large", "size": "1.5rem", "name": "Large" }
      ]
    },
    "spacing": { "customSpacingSize": false }
  }
}
```

With `custom: false` and `defaultPalette: false`, the colour picker shows only the three brand colours. With `customFontSize: false`, editors pick from Small, Medium and Large instead of typing 37px.

You can loosen settings per block. For example, allow custom colours only in the Button block for a seasonal campaign:

```json
"blocks": {
  "core/button": { "color": { "custom": true } }
}
```

## Layer 2: lock template structure

Block locking stops editors moving or removing blocks. In a template or pattern, add a `lock` attribute:

```html
<!-- wp:group {"lock":{"move":true,"remove":true},"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
  <!-- wp:heading {"level":1} /-->
  <!-- wp:paragraph /-->
</div>
<!-- /wp:group -->
```

For a whole area where editors should only change text, use `templateLock` on the container:

- `"templateLock": "all"`: no inserting, moving or removing blocks inside.
- `"templateLock": "insert"`: blocks can be reordered but not added or removed.
- `"templateLock": "contentOnly"`: only the content of text and media blocks can be edited; the structure and styles are hidden from the editor.

`contentOnly` is the most useful for service pages and landing pages: the editor sees the text and images, nothing else.

## Layer 3: give editors patterns, not blank pages

Most layout damage happens when an editor has to build a section from scratch. Register the sections they need as patterns in the theme's `patterns/` folder: testimonial row, team member card, service grid, call-to-action band. Each pattern file starts with a header comment:

```php
<?php
/**
 * Title: Service grid (3 columns)
 * Slug: clienttheme/service-grid
 * Categories: featured
 */
?>
<!-- wp:group {"templateLock":"contentOnly"} -->
...
<!-- /wp:group -->
```

Combine patterns with `contentOnly` locking and editors can add a new service section in seconds without touching spacing or fonts.

## What to leave unlocked

Over-locking frustrates editors and leads to support tickets. Leave unlocked:

- Blog post content (writers need headings, lists, images and embeds).
- The order of sections on landing pages, if marketing runs experiments.
- Image choice and alt text everywhere.

Administrators can still unlock blocks when needed, so locks protect the design without removing control from the people responsible for it.

## Testing the setup

Before hand-over, sign in as an Editor (not an Administrator) and try to break a page: change a colour, resize text, delete a locked section. Anything you can break, the client will eventually break. Then record a short screen video of adding a page from a pattern.

## FAQ

**Does locking affect the front end?**
No. Locks only change what the editor allows; the published HTML is the same.

**Can classic themes do this?**
Partly. Classic themes can add `theme.json` for settings, but templates and template parts as blocks need a block theme.

**Will a theme update remove the locks?**
Locks in theme files update with the theme. Locks set in the Site Editor are stored in the database, so document which is which.

This is part of how our team at [Dzimark](https://dzimark.com/services/wordpress-development/) builds WordPress sites that clients can edit safely.

