-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Labels
ChecksAudit/test of the particular part of the pluginAudit/test of the particular part of the plugin[Team] PluginsIssues owned by Plugins TeamIssues owned by Plugins Team
Description
Add a static check that flags editor blocks whose block.json does not declare apiVersion 3 or higher, to align with the WordPress 7.0 iframe editor requirement.
Background
Starting with WordPress 7.0, the post editor will run in an iframe. Blocks are expected to use apiVersion 3 (or higher) for compatibility. Blocks with no apiVersion or with apiVersion < 3 may not behave correctly in the iframed editor.
References
- Preparing the Post Editor for Full iframe Integration (Make WordPress Core)
- API Versions (Block Editor Handbook)
- Migrating Blocks for iframe Editor Compatibility (Block Editor Handbook)
Severity
- New plugins (first-time submission): Error —
apiVersion3+ must be present and correct; otherwise the check fails (mandatory). - Existing plugins (updates / “actual plugin” mode): Warning — same condition is reported as a warning so authors can fix it before it becomes mandatory.
Proposed behavior
- Scope: All
block.jsonfiles in the plugin (any directory). - Pass: Every
block.jsonhasapiVersionset to3or higher (e.g.3,4). - Fail:
apiVersionmissing or empty, orapiVersionset to1or2(or any number < 3).
- Message: State that editor blocks must use apiVersion 3 or higher for WordPress 7.0+ and link to the migration/API version docs above.
Example failure (anonymized)
- File:
example-plugin/build/block.json(orsome-plugin/includes/blocks/my-block/block.json). - Issue:
apiVersionis not defined or empty. - Recommendation: Add
"apiVersion": 3(or higher) toblock.json.
Implementation notes
- Implement as a static check extending
Abstract_File_Check: discover allblock.jsonfiles under the plugin, parse JSON, validateapiVersion(presence and ≥ 3), and add one result per file (error or warning based on context). - Register the new check in
Default_Check_Repository(or current equivalent). - Category: General or Plugin_Repo (e.g. Plugin_Repo if this is a directory requirement).
- Severity by context:
- New plugin submission: report as Error (mandatory).
- Existing plugin (update / current plugin mode): report as Warning.
- Add unit tests for: missing/empty
apiVersion,apiVersion1 or 2 (fail), andapiVersion3+ (pass).
Acceptance criteria
- All
block.jsonfiles in the plugin are inspected. - Missing or empty
apiVersionis reported (error for new plugins, warning for existing). -
apiVersion1 or 2 is reported as outdated (error for new, warning for existing); 3+ is accepted. - New plugins: check is mandatory (Error); existing plugins: Warning.
- Check is registered and runs in the Plugin Check UI and WP-CLI.
- Documentation updated if new checks are documented.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ChecksAudit/test of the particular part of the pluginAudit/test of the particular part of the plugin[Team] PluginsIssues owned by Plugins TeamIssues owned by Plugins Team
Type
Fields
Give feedbackNo fields configured for issues without a type.