0

I would like to run a function after I load the meta box/components into the sidebar just in the gutenberg editor.

I know I could do it with add_action('add_meta_boxes'), but the function I want to run only works in the gutenberg editor. So how do I make this shot on Gutenberg's JS?

Tried something like below, but doesn't work.

wp.hooks.addAction('add_meta_boxes', 'cgb/generic-call-block', function () {
    console.log(
        'after the editor sidebar components have loaded'
    )
})
1
  • It's not entirely clear what you are attempting to accomplish. Which function are you trying to use which you say only works in the Block Editor? I'm not sure what you mean by "meta box/components" - are custom React components involved here?
    – bosco
    Aug 1 '21 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.