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');
Disclaimer: The content in this post is for educational purposes only. Always remember to take a backup before doing any of the suggested steps just to be on the safe side.
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer