Let’s say I have two customizer controls “setting_category” and “setting_font”, I’m trying to change the choices of “setting_font” upon changing the value of “setting_category”. Here’s what I’m doing:

( function( $ ) {
    var api = wp.customize;

    api( 'setting_category', function( value ) {
        value.bind( function( to ) {
            var newChoices = {};
            // get new data from JSON using 'to' and populate the 'newChoices'

            api( 'setting_font' ).changeTheChoices( newChoices );
        } );
    } );
} )( jQuery );

How can it be done with JavaScript? Any trick?

Read more here: Changing the entire control choices using wp.customize with JavaScript


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: