I'm building a plugin that does some transformations on front page through JS script.

I'm trying to build a contextual control in the customizer so that when a certain section is opened I modify the view in iframe_

what's the correct listener (and hook) for the section menu-toogle "open" event ?

1 Answer 1


So far the only solution I've come up with is creating a function that postMessages the event into the iframe (using customize_controls_enqueue_scripts hook).

As for the receiver in iframe (hooked on customize_preview_init hook) I think it could still need some optimization because I'm getting a weird issue with window.addEventListener('message',* getting some duplicate on customizer loading..

But probably it's the way it's supposed to work since i'm using the customize_preview_init hook twice.

Since I feel their might be better ways any feedback or comment is welcome_

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.