Theme Customization API — a practical guide to WordPress Theme Customization API with clear examples you can reuse in real projects.
WordPress Theme Development Series (29/96). Prefer one article? Read the complete WordPress theme development tutorial.
Short description
Register panels, sections, settings, and controls so users can change colors, logos, and text with preview.
Customize register sketch
add_action('customize_register', function ($wp_customize) {
$wp_customize->add_section('acme_colors', ['title' => 'Theme Colors']);
$wp_customize->add_setting('acme_primary_color', ['default' => '#0f766e', 'sanitize_callback' => 'sanitize_hex_color']);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'acme_primary_color', [
'label' => 'Primary color',
'section' => 'acme_colors',
]));
});