Plugins can't use block filters in the editor when Jetpack is enabled #11464
Labels
[Focus] Blocks
Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack
[Pri] Normal
[Type] Bug
When a feature is broken and / or not performing as intended
Description
Jetpack enqueues scripts that depend on
wp-blocks
. When we have plugins that need to register filters used bywp-blocks
, they end up loading and running after Jetpack, which has loadedwp-blocks
and so the filters aren't registered in time to run.Steps to reproduce the issue
This uses my WIP PR for extending the embed blocks to highlight the issue, but it should be reproducable with a simpler plugin, look at the
extend-embeds
plugin in the PR.extend-embeds
pluginhttps://www.reddit.com/r/stevenuniverse/comments/ax0u5i/innocence/
This will trigger the test plugin's behaviour, and you'll see a very boring "custom preview" message, and the block will be "Reddit with extra stuff"Analysis so far
This doesn't seem specific to this code or plugin. Scrips that need to load before
wp-blocks
end up loading after the code inwp-blocks
has been run, once Jetpack is enabled, because Jetpack has already required it.The test plugin in the PR enqueues its scripts like this:
That works when Jetpack isn't present, the script is loaded before
wp-blocks
and registers the filter before the core blocks are registered, allowing the plugin to use the hooks thatwp-blocks
uses.There isn't a way (that I can see) to say "make sure this loads BEFORE wp-blocks" and so when Jetpack does this in
class.jetpack-gutenberg.php
then
wp-blocks
before Jetpack'sblocks/editor.js
, and it's too late for other plugins to do what they need to do.The text was updated successfully, but these errors were encountered: