Hook for when gutenberg editor is initialized?

Question

I’m currently writing a plugin that adds a couple of gutenberg blocks.

Some of the blocks require the need for a script block to exist that contains api information from facebook right when the body tag is opened.

I’ve already added the script block to header.php which does indeed work when previewing the page using the blocks, but I would like to be able to have the blocks still contain facebook data when you’re inside of the gutenberg editor.

One way which I’ve solved it is doing an add_action('init', 'initFBApiBlock'); call in the plugin.php which works but was wondering if there was a better way of doing it.
I know that body_begin for example exists but that would create the same result.

Any ideas?

0
, Kevin All 3 months 0 Answers 55 views 0

Leave an answer