0

How can I stop the refresh event for the Customizer iframe? Something like:

wp.customize.refresh( function() {
    return; // or whatever would stop the refresh
} );

The background: I'm using Kirki to add a code editor field to the front end Customizer. It gets an option from my theme option's custom CSS area (not a theme I developed, so I cannot use traditional theme_mod) and I can properly get/put the data from this option to write custom CSS from the front end Customizer.

For the live edit to work, I modified the front end custom CSS <style> element to have a unique ID, and using CodeMirror's update event I can replace the <style> element's contents successfully and see the live changes. However, the Customizer refresh event also fires just moments after, thus wiping out the updated <style> element.

1 Answer 1

0

I found the answer here: https://developer.wordpress.org/themes/advanced-topics/customizer-api/

Using 'transport' => 'postMessage' in my fields settings array. Kirki also provides passing this option too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.