You’re close. You just need to replace changeTheChoices()
with set()
as this is a method on wp.customize.Setting
. See the following which also refactors a bit:
wp.customize( 'setting_category', 'setting_font', function( categorySetting, fontSetting ) {
categorySetting.bind( function( category ) {
var newChoices = {};
// get new data from JSON using 'category' and populate the 'newChoices'
fontSetting.set( newChoices );
});
});
Tip: I suggest not using “setting
” in the IDs for your settings.
Related Posts:
- Does the functions.php file ever get called during an AJAX call? Debug AJAX
- Trigger Customizer saving process with Javascript only
- WordPress Customizer Typography: How to load just the unique Google Fonts?
- How to Change CSS Variable value in Theme Customizer Live Preview
- WordPress Customizer Control with React
- How to hook CSS file according to theme selection in the customizer section
- Using an if statement in the theme customizer page
- Theme Customizer not loading JS for live preview
- pass wordpress template directory into ajax url call
- how use ajax to custom page template
- Ajax Comment Upvotes – Votes don’t always register
- Customizer Image-Picker Preview Not Working
- Using Customizer value in an external PHP file inside a theme
- Theme customizer live preview JS- Trying to bind to an html image url without luck
- WP Customizer get control value on change
- Execute javscript when theme customizer loads (autosave issue)
- How To extend WP_Customize_Control
- theme path in javascript file
- Solutions for generating dynamic javascript / CSS
- Get entered value of customiser field for live preview
- Allowing admin-ajax.php to receive “application/json” instead of “x-www-form-urlencoded”
- Proper, exhaustive documentation for wp.editor etc
- Theme Customizer : how to create multiple-level panel
- Customizer Active Callback not working
- How to execute conditional script when on new customize.php (Theme Customize) screen
- Adding customizer styles with wp_add_inline_style
- Is it possible to display the admin bar while in the Theme Customizer?
- How do I get a parent theme modification from a child theme?
- “Display Site Title and Tagline” checkbox not working?
- How to set page template on front using starter content?
- Whats the safest way to output custom JavaScript and Css code entered by the admin in the Theme Settings?
- Can’t access WordPress functions in file called via Ajax?
- Change setting name in Customizer and keep the data
- How to correctly add JQuery in a WP theme?
- after_setup_theme, Global Variable and Theme Customizer
- Including Javascript options
- trying to use wp_handle_upload with ajax
- How can i add edit shortcut icon in wordpress customizer without using selective refresh?
- WordPress customizer refresh screen after save
- Add new panel inside parent panel in WP Customize?
- Unable to pass variable on theme cusomizer add_settings()
- How to add field customizable by the theme editor to your theme?
- JavaScript Change focus to password field login page being reset
- Get a setting value conditionally in the Customizer api
- WP_Customize_Color_Control omitting # symbol
- Creating a Multi-Level Associative Object Using AJAX
- How to make Isotope and WordPress work together?
- Theme-wide custom post template
- How to add material design css in wordpress and woocommerce
- JS innerhtml changing style when using AJAX
- How do I query posts by a sub value with the API?
- Theme Javascript.php Overwritten Nightly [closed]
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- How to get javascript slider to work! [closed]
- The ‘default’ attribute from $wp_customize->add_setting() method not in db?
- Override customizer values on a per-menu base
- Post thumbnail to append post content via ajax click event
- Would to use AJAX to get an option from the database and use it in a jquery setup or is there an alternative to consider?
- Why in the static pages of my theme are showing these information?
- ajax response -1 in wordpress theme
- Can I make a Customizer dropdown-pages list include private pages?
- Why does admin-ajax load slow and what are ways to speed it up?
- Doing context-aware previews in the WordPress Customizer
- Alignment Problem [closed]
- Theme logo metadata into template file
- Customizer: get_preview_url() inside customize_save_after hook
- WP Customazation API doesn’t save the default Value
- WordPress API functions not working at AJAX functions.php call
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- AJAX call fails when sending JSON but works with URL style string
- Related Post Category Filter
- Let user to upload multiple time
- getBoundingClientRect() showing different values on load vs scroll
- wordpress script_loader_tag in function.php
- How to diagnose wp-env environment problem
- How to properly use AWS SES for a contact form?
- WordPress Insert ads after every 5th post
- How to dynamically set a background image with the customizer without putting the css as an inline-style
- Default customizer colors aren’t displayed outside of the preview
- WordPress Custom Theme : Theme Builder vs ACF vs Gutenberg
- fetch all post from wp multisite network and sort all the post in descending order on the basis of “Created by ” term
- (Parent) theme Is Not Showing In Theme Selection Panel and Therefore Breaks Child Theme
- my ajax wont sent the data, please correct my code
- Text View (Code View) in WordPress Customizer TinyMCE Editor
- How to send Ajax Call from frontend without using wp_localize_script in Theme
- Debugging slow WordPress Theme Customizer (Any option similar to Query Monitor)?
- Add multiple sections, settings and controls at once to the Customizer
- Missing hashtag with theme customizer header color
- Customizer_register theme options not saving
- Editable screenshot.png in a custom theme developed
- get_theme_mod not pulling css colors into header using wp_head
- Retrieve customizer value using ajax or customizer api and print the value in theme
- How to avoid Ajax in wordpress theme in making mulitple request?
- wp_deregister_script was called incorrectly
- Using wp_enqueue_script with social media buttons?
- Theme now uses require.js and enqueue script no longer works
- WP site makes mobile browser crash for high memory usage
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- jQuery Snippet Not Working on WordPress Site [closed]
- Is there any halfway decent documentation on the wp.media JS class?