# Lock the Editor to Theme Colors and Font Sizes

> Removes the custom color picker, default palettes and custom font sizes from the block editor, so editors can only use your theme's brand styles.

- Type: PHP
- Runs: Run everywhere
- Category: [Disable Features](https://wpide.com/library/category/disable-features/)
- Tags: disable, editor, branding
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/lock-editor-to-theme-styles/

## Code

```php
add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) {
    return $theme_json->update_with( array(
        'version'  => class_exists( 'WP_Theme_JSON' ) && defined( 'WP_Theme_JSON::LATEST_SCHEMA' ) ? WP_Theme_JSON::LATEST_SCHEMA : 3,
        'settings' => array(
            'color'      => array(
                'custom'          => false,
                'customGradient'  => false,
                'customDuotone'   => false,
                'defaultPalette'  => false,
                'defaultGradients' => false,
                'defaultDuotone'  => false,
            ),
            'typography' => array(
                'customFontSize'   => false,
                'defaultFontSizes' => false,
            ),
        ),
    ) );
} );
```

## Notes

If your theme defines no palette or font sizes of its own, editors are left with none to choose from.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Lock the Editor to Theme Colors and Font Sizes" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
