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)
- Theme-wide custom post template
- Edit footer via customizer
- How to add material design css in wordpress and woocommerce
- How do i make a custom section’s setting display the default value in Customizer?
- JS innerhtml changing style when using AJAX
- How to add styles set by user in the customizer
- Use second time navigation.js in underscores [closed]
- Disabling Customizer Selective Refresh shortcut icons for selected controls
- JavaScript stops working on selectively refreshed sections one inside the other
- Folder name for a pro version of a WordPress.org theme?
- Display theme layouts [closed]
- “Add A Widget” button in the Customizer
- Can I add multiple arrays within add_theme_support( ‘colors’ )?
- How do I query posts by a sub value with the API?
- Theme Javascript.php Overwritten Nightly [closed]
- Customizer: save setting/control content to post/page
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- How to: JQuery multiple wordpress media uploader buttons in the same options page?
- Radio buttons live refresh in the customizer
- Using WordPress’ Theme Customizer to select page templates that update layout in the preview
- Dynamically generated wordpress customizer options?
- Is accessing theme and using customizer GPL distribution?
- How to get javascript slider to work! [closed]
- Retrieve localised value
- How to disable wordpress from overload my stylesheet styles with customizer styles
- AJAXIFY WordPress Theme Frontend menu
- The ‘default’ attribute from $wp_customize->add_setting() method not in db?
- Override customizer values on a per-menu base
- How to modify default controls in WordPress theme customizer
- How to enqueue javascript for WP Customize options sidebar?
- Is it possible to visually group items on the theme customizer?
- 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?
- Customizer – loading settings/controls/sections/panels based on a id/page id
- My jQuery is enqueued properly. So why isn’t it working?
- Enqueued JavaScript is not working
- Change WordPress header color using customizer
- Default Text not showing from customizer
- Is there any way to register custom background images like header images?
- How to transfer one domain to another domain without losing theme options (customizer)?
- Why in the static pages of my theme are showing these information?
- How to register and enqueue JavaScript files without breaking plugin dependencies?
- wp_enqueue_script not working?
- Theme Customizer not displaying saved values in wp_head (CSS)
- Is there a WordPress boolean for “theme_customizer_active()”?
- ajax response -1 in wordpress theme
- Can I make a Customizer dropdown-pages list include private pages?
- How to allow certain PHP functions when using sanitize_callback in the word press customizer
- How can I wrap all blog posts image with
- Customizer Color Control Not Working
- where is real values of variables?
- White screen when attaching css to function.php
- How to allow users to create their own website within my domain? [closed]
- WordPress theme resource won’t load over VPN
- Why does admin-ajax load slow and what are ways to speed it up?
- Why WordPress AJAX returns undefined however it works fine when I add static url instead of dynamic function?
- Doing context-aware previews in the WordPress Customizer
- How to set Post meta-box defaults based on the choices made by user in Customizer?
- How to use ajax in wordpress and sending the data without refreshing ?
- Issue on Accessing To Ajax Enqeued File to Pass to URL for Ajax Call
- theme-independent CSS/JS files
- Alignment Problem [closed]
- Avada Child Theme Development
- Questions from a new WP Dev [closed]
- Adding a new setting using Kirki or WP customizer with an if statement
- Theme customizer – can’t add section/settings
- Create something that can be added or removed in Customizer
- Theme logo metadata into template file
- Customizer: get_preview_url() inside customize_save_after hook
- Javascript development in Custom Themes
- WP Customazation API doesn’t save the default Value
- add shortcode support in customizer
- Ajax call returns 0 when add_action is inside a class in functions.php
- WordPress API functions not working at AJAX functions.php call
- Twenty Twelve Author not displaying
- add jquery file if a certain page is included
- Customize Option Framework
- Retrieve WordPress’ the_content() with jQuery
- 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
- How to set a custom URL for the iframe in the customize page
- Related Post Category Filter
- Pagination don’t work with active filters
- enqueuing external and internal js and css in wordpress did not work with owl.js animate.css