id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 41271,Customizer sanitize_callback gets called multiple times on setting change,kylejennings83,,"I've noticed that the my Customizer setting sanitize_callback get's called multiple times (4). I think I have deduced that it's not anything weird I'm doing and that it's not a result of a conflicting plugin. Using VVV, I spun up a new site, deactivated all the plugins and using only the default Twenty Seventeen theme I added the following to functions.php file: {{{#!php add_setting( 'sidebar_size_setting', array( 'default' => 'wide', 'sanitize_callback' => function($val) { error_log('boom'); // to test }, ) ); $wp_customize->add_control( 'sidebar_size_control', array( 'label' => 'Sizebar Size', 'section' => 'title_tagline', 'settings' => 'sidebar_size_setting', 'type' => 'select', 'choices' => array( 'wide' => 'Wide', 'narrow' => 'Narrow', ), ) ); } add_action('customize_register', 'wp_132423_customize_settings'); }}} Then I opened the Customizer and changed my ""Sizebar Size"" control from wide to narrow while tailing the error log which shows: {{{ [07-Jul-2017 18:12:22 UTC] boom [07-Jul-2017 18:12:22 UTC] boom [07-Jul-2017 18:12:22 UTC] boom [07-Jul-2017 18:12:22 UTC] boom }}} I noticed this while trying to find a way to run a function in the backend whenever a particular setting was changed. Seemed like the sanitize_callback was a good place to hook into and noticed this. ---- Related: #32103, #42558.",defect (bug),closed,normal,,Customize,4.8,normal,maybelater,needs-patch,,performance