I've seen some plugins enqueue Gutenberg/block editor scripts via the enqueue_block_assets hook even though the scripts in question are only needed in the block editor and should be enqueued via enqueue_block_editor_assets. One example I remember is this changeset in plugin trac (line 12-14)
This can cause editor-related scripts, including their dependencies, to be loaded on the frontend as well, hurting page speed.
I have seen this in multiple plugins. I think it's because either AI coding agents just get this wrong, or the hook names themselves are easy to confuse.
A check could help by detecting assets enqueued via enqueue_block_assets that depend on editor-only scripts. If a script depends on packages such as wp-block-editor, or similar editor-specific dependencies, it is likely not meant to be loaded on the frontend.
I've seen some plugins enqueue Gutenberg/block editor scripts via the enqueue_block_assets hook even though the scripts in question are only needed in the block editor and should be enqueued via enqueue_block_editor_assets. One example I remember is this changeset in plugin trac (line 12-14)
This can cause editor-related scripts, including their dependencies, to be loaded on the frontend as well, hurting page speed.
I have seen this in multiple plugins. I think it's because either AI coding agents just get this wrong, or the hook names themselves are easy to confuse.
A check could help by detecting assets enqueued via
enqueue_block_assetsthat depend on editor-only scripts. If a script depends on packages such aswp-block-editor, or similar editor-specific dependencies, it is likely not meant to be loaded on the frontend.