Trigger Customizer saving process with Javascript only

Instead of using jQuery to update the value of the custom input, use the wp.customize object’s set() function (found in customize-base.js):

wp.customize( key, function ( obj ) {
    obj.set( newValue );
} );

Where key is the setting, and newValue is the updated value.

Also, worth noting, in the class that extends WP_Customize_Control, make sure to use $this->get_link() to put the data attribute data-customize-setting-link on the custom input (found in class-wp-customize-control.php).

Leave a Comment