WordPress / WordPress/plugin-check

Warn when editor-only block assets are enqueued via enqueue_block_assets

Open
#1,360 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
362
Forks
126
Avg merge
1d 23h
Merged PRs (30d)
22

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how Plugin Check observes assets enqueued through enqueue_block_assets and how script dependencies are represented. Compare dependencies such as wp-block-editor and identify which editor-only packages should trigger a warning. Done means the check flags frontend-enqueued editor-only assets without warning on valid block assets.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
performance, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.