Warn when editor-only block assets are enqueued via enqueue_block_assets

オープン
#1,360 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@ishitaj34 がすでに取り組んでいます。

2026年6月18日 から。

  • #1366 @ishitaj34 による — オープン
  • #1515 @OllieinCanada による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
php, wordpress

調査の方向性

まず、Plugin Check が enqueue_block_assets を通じて enqueue されたアセットをどのように監視し、スクリプトの依存関係がどのように表現されているかを追跡します。wp-block-editor などの依存関係を比較し、エディター専用のどのパッケージが警告を発生させるべきかを特定します。妥当なブロックアセットについては警告せず、frontend-enqueued されたエディター専用アセットをチェックが検出すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
PHP
スター
365
フォーク
135
平均マージ
1日 8時間
マージ済み PR(30日)
20

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

WordPress/plugin-check のほかの issue

WordPress/plugin-check の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。