wp.customize is undefined in customizer scripts
Question
I have some scripts I am loading in the customizer like this:
add_action('customize_controls_enqueue_scripts', function() {
wp_enqueue_script('jquery');
wp_enqueue_script('json-editor', 'https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.0.5/jsoneditor.min.js');
wp_enqueue_style('json-editor', 'https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.0.5/jsoneditor.min.css');
wp_enqueue_script('wf-customizer', get_template_directory_uri() . '/assets/js/customizer.js');
wp_localize_script('wf-customizer', 'conditions', $this->conditions);
});
In the wf-customizer
script, I am trying to use this:
wp.customize.bind('ready', function() {
//...
});
But I keep getting Cannot read property 'bind' of undefined
in the JS console. Somehow, wp.customize
is undefined for me.
0
4 months
0 Answers
17 views
0
Leave an answer
You must login or register to add a new answer .