Make editors choose from your theme's palette and font sizes only, by removing the custom colour picker and size input.
add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) {
return $theme_json->update_with( [
'version' => 3,
'settings' => [
'color' => [
'custom' => false,
'customGradient' => false,
'customDuotone' => false,
],
'typography' => [
'customFontSize' => false,
],
],
] );
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
Brand guidelines fall apart when everyone can pick any colour and any font size. This snippet limits editors to the palette and sizes your theme defines.
WordPress builds editor settings from theme.json. The wp_theme_json_data_theme filter lets you change the theme’s settings in PHP, even if the theme has no theme.json file. Turning off custom, customGradient, customDuotone and customFontSize removes the free colour pickers and the custom size field, leaving only the presets.
This works for classic themes and block themes.
Select a paragraph and open the colour panel. You should see the palette but no “Custom color” picker.