Category: WordPress

This weird looking snippet will help you read a WP customzer value dynamically. You'll have to enqueue the JS at the right spots.

For example:

  • customize_preview_init
  • customize_controls_enqueue_scripts

How to get a WordPress customizer field value?

var some_value = wp.customize.value( 'my_field_setting' )();

How to set a WordPress customizer field value?

var some_value = wp.customize.value( 'my_field_setting' )('some_value');

 

Related
https://stackoverflow.com/questions/33234217/wp-customize-get-value-from-a-setting-and-store-in-a-variable

 

Join our mailing list

Get important news about cool products we release and invitations to beta test new products
We're working on a secure & flexible WordPress hosting solution. Read for more info (has 1min video)