wp-block-editor
/wp-block-editor
Pomaga tworzyć bloki Gutenberg w WordPressie: pliki block.json, edycję i zapis bloków, stan edytora i rozszerzanie bloków.
- Autor
- alvaroleon ↗
- Repozytorium
- wp-block-editor-skill ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 31.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 15
- Skrypty
- 0
- Komentarze HTML
- 2
- Adresy URL w SKILL.md
- 4
Brak sygnałów. Repozytorium zmienione 31.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- SKILL.md zawiera komentarze HTML (2). Nie widać ich w podglądzie Markdown, a model je czyta.
Co robi i kiedy
Pomaga tworzyć bloki Gutenberg w WordPressie: pliki block.json, edycję i zapis bloków, stan edytora i rozszerzanie bloków.
Oryginalny opis (EN)
Use when working on the WordPress Block Editor (Gutenberg), verified against WP 7.1.4 — custom blocks (block.json, edit/save, attributes, supports, create-block), block UI from @wordpress/components & block-editor (RichText, InspectorControls, InnerBlocks, SlotFills, DataViews/DataForm), editor state via @wordpress/data & core-data, extending core/third-party blocks (filters, styles, variations, Query Loop, Block Bindings), dynamic & PHP-only blocks (render.php, ServerSideRender, autoRegister), theme.json/Global Styles (responsive and state styles), the Interactivity API, patterns & Pattern Ov
Jak działa
- Before writing code: which WordPress?
- What changed, by version
- Mental model
- Decision tree — which reference do I load?
- Architectural quick reference
- File anatomy of a typical block
- Iframed editor: test matrix (WP 7.1+)
- Meta references
- Common mistakes
- Cross-reference jumps
Podgląd SKILL.md
---
name: wp-block-editor
license: MIT
description: Use when working on the WordPress Block Editor (Gutenberg), verified against WP 7.1.4 — custom blocks (block.json, edit/save, attributes, supports, create-block), block UI from @wordpress/components & block-editor (RichText, InspectorControls, InnerBlocks, SlotFills, DataViews/DataForm), editor state via @wordpress/data & core-data, extending core/third-party blocks (filters, styles, variations, Query Loop, Block Bindings), dynamic & PHP-only blocks (render.php, ServerSideRender, autoRegister), theme.json/Global Styles (responsive and state styles), the Interactivity API, patterns & Pattern Overrides, block i18n, media uploads from the editor, the iframed editor, Abilities API, AI Client/Connectors, SVG Icon API, core/breadcrumbs. Trigger on "block", "Gutenberg", "editor sidebar", "custom panel", or anything inside the wp-admin block editor.
---
# WordPress Block Editor (Gutenberg) — Router
Single entry point for the Block Editor / Gutenberg ecosystem, **verified against WordPress 7.1.4** (2026-10-28) source and the 7.0/7.1 dev notes. This SKILL.md is a **router + architectural map**: load the reference file under `references/` for the task at hand, **only when relevant**.
## Before writing code: which WordPress?
1. **Find the project's real versions**: installed core (`wp-includes/version.php` → `$wp_version`), minimum supported (plugin header `Requires at least:`, theme `style.css`, `readme.txt`), PHP minimum, and whether the **Gutenberg plugin** is active (it ships features core doesn't have). Never assume 7.1.4 because this skill says so.
2. **Gate APIs newer than the minimum.** PHP: `function_exists( 'wp_register_icon' )` or `is_wp_version_compatible( '7.1' )`. JS: feature-detect the export before calling it. Unknown `block.json` supports and `theme.json` keys are silently dropped by older cores (theme.json is pruned to its schema), so they degrade instead of failing — but the feature is then missing.
3. **Source of truth, in order**: installed core source for the deployed version → version-specific dev notes (Field Guides) → developer.wordpress.org handbook → these references. If they disagree, trust the source and say so. Gutenberg-plugin docs often describe features core doesn't ship yet.
## What changed, by version
| Version | Developer-facing change | Read |
|---|---|---|
| 6.9 | Abilities API (server: `wp_register_ability`) | `extending.md` |
| 7.0 | PHP-only blocks (`supports.autoRegister`); block visibility per viewport (`supports.visibility`, stored in `metadata.blockVisibility`); `dimensions` width/height, `customCSS`, `typography.textIndent`; pattern editing / `contentOnly` by default; Pattern Overrides for custom blocks; client-side Abilities (`@wordpress/abilities`); WP AI Client + Connectors; `core/breadcrumbs`; Interactivity `watch()` and router `state.url`; script-module i18n; PHP ≥ 7.4 | per row below |
| 7.1 | Post editor **always iframed** (any theme, any `apiVersion`, also with meta boxes); responsive (`@mobile`/`@tablet`) and state styles in Global Styles, configurable `settings.viewport`, `textShadow`; supports `background.gradient` and `dimensions.minWidth`; SVG Icon API + `core/icon`; Abilities `meta.public`, lifecycle filters, `wp_get_abilities()` args; DataViews/View Config filters; client-side media processing; 40px form controls unconditional | per row below |
| 7.1.4 | Security release: Interactivity API binding hardening (`javascript:` URLs, `on*` attributes, `<object>`, context prototype pollution, router responses), block delimiter XSS fix | `interactivity-api.md` |
**Not in core 7.1.4** (don't use or claim them): React 19 (core ships **React 18.3**), real-time collaboration (removed from 7.0, deferred again in 7.1; Gutenberg plugin only), hiding the Classic block (reverted).
## Mental model
The Block Editor is a React app embedded in `wp-admin` (and the Site Editor). It serializes blocks into `post_content` as HTML with HTML comment delimiters carrying the block's name and attributes:
```html
<!-- wp:my-plugin/card {"eventId":42} -->
<div class="wp-block-my-plugin-card">…</div>
<!-- /wp:my-plugin/card -->
```
A custom block is fundamentally:
1. **`block.json`** — metadata (name, attributes, supports, scripts/styles, render).
2. **`edit()`** — React component shown inside the editor canvas (an iframe).
3. **`save()`** — pure function returning the markup serialized to `post_content` (or `null` for dynamic blocks, which use a PHP `render.php`).
Everything else (filters, SlotFills, theme.json, patterns, Interactivity API) extends or composes around that core.
## Decision tree — which reference do I load?
| You want to… | Read |
|---|---|
| Scaffold/create a new custom block (`block.json`, edit/save, attributes, supports, `@wordpress/create-block`, `@wordpress/scripts`) | `references/create-block.md` |
| Build the block's UI (RichText, InspectorControls, BlockControls, InnerBlocks, media upload, DataViews/DataForm, SlotFills, Design System tokens) or upload media from a block | `references/components.md` |
| Read/write editor state (selected block, post meta, entities, custom store, `executeAbility`, icon entities) | `references/data.md` |
| Extend a block you don't own (JS/PHP filters, HoC over BlockEdit, block styles, variations, Query Loop, Block Bindings sources), breadcrumbs filters, SVG Icon API, Abilities (server), AI Client/Connectors | `references/extending.md` |
| Render from PHP at view time (`render.php`, `render_callback`, `ServerSideRender`, view scripts) or ship a block with no JS (`supports.autoRegister`) | `references/dynamic-blocks.md` |
| Deep block.json semantics: attribute sources, `context`, `transforms`, `deprecated`, API versions, block hooks, `selectors`, supports (`visibility`, `dimensions`, `background.gradient`, `customCSS`, `textIndent`) | `references/block-api.md` |
| Configure `theme.json` (settings, styles, presets, `blocks.*`, responsive/state styles, viewports, FSE) | `references/theme-json.md` |
| Frontend interactivity (directives, `store()`, server state, `watch()`, client-side navigation, 7.1.4 binding rules) | `references/interactivity-api.md` |
| Register/group block patterns, `contentOnly` editing, Pattern Overrides | `references/patterns.md` |
| Translate strings in JS/PHP (`wp_set_script_translations`, `wp_set_script_module_translations`) | `references/i18n.md` |
If the task touches several rows, load them in order of need. The most common combo is **create-block + components + data**.
## Architectural quick reference
- **Packages** live under `@wordpress/*`: `blocks`, `block-editor`, `components`, `data`, `core-data`, `editor`, `element` (React 18.3 wrapper), `i18n`, `compose`, `hooks`, `plugins`, `notices`, `api-fetch`, `interactivity`, `interactivity-router`, `abilities`, `upload-media`.
- **Stores** (Redux-style): `core`, `core/block-editor`, `core/editor`, `core/notices`, `core/preferences`, `core/keyboard-shortcuts`, `core/rich-text`, `core/viewport`.
- **Hooks** (WP-style PHP/JS filters): `wp.hooks.addFilter` / `add_filter`. Filter name = dotted path (e.g. `editor.BlockEdit`); plugin namespace = `vendor/feature`.
- **Build**: `@wordpress/scripts` (`wp-scripts start|build`) handles JSX/SCSS/WP externals. `@wordpress/create-block` scaffolds a plugin in one command. Never bundle React; let the externals map it.
- **Registration sides**: JS (`registerBlockType`) and PHP (`register_block_type( __DIR__ )` pointing at the directory with `block.json`). Both read the same `block.json`.
## File anatomy of a typical block
```
my-plugin/
├── my-plugin.php # boot + register_block_type( __DIR__ . '/build/my-block' )
├── package.json # @wordpress/scripts
└── src/my-block/
├── block.json # metadata (single source of truth)
├── index.js # registerBlockType( metadata, { edit, save } )
├── edit.js # React component for the editor
├── save.js # serializer (or returns null + render.php exists)
├── render.php # only for dynamic blocks (server-side render)
├── view.js # frontend script (only if Interactivity API or vanilla JS)
├── style.scss # styles for both editor and frontend
└── editor.scss # editor-only styles
```
## Iframed editor: test matrix (WP 7.1+)
The canvas has its own `document`/`window`. Before shipping a block or editor extension, check:
1. Existing posts with legacy content and your custom blocks (no "invalid block" notices, no console errors).
2. A post type that registers **classic meta boxes** — 7.1 iframes it too.
3. Canvas styling: CSS reaches the iframe only via `block.json` `style`/`editorStyle` or `enqueue_block_assets`, not `enqueue_block_editor_assets` / admin-page CSS.
4. DOM access and events: `ref.current.ownerDocument` / `.defaultView`, `useRefEffect`; nothing like `document.querySelector()` from the admin page into the canvas.
5. Focus, keyboard navigation, previews (device preview, `ServerSideRender`) and the frontend output.
6. Third-party editor extensions the project relies on.
## Meta references
| Read… | When you need… |
|---|---|
| `references/handbook-map.md` | Official handbook map, Field Guides and dev-note URLs for deeper dives |
| `references/decision-tree.md` | Verbose version of the router table, with trigger phrases |
## Common mistakes
- Calling `registerBlockType` only in JS without `register_block_type()` in PHP — dynamic blocks won't render on the frontend and lose i18n/asset auto-loading.
- Ending `render.php` with `return ob_get_clean();`. Core already wraps the file in `ob_start()` / `require` / `ob_get_clean()` and discards its return value, so the block renders empty. The file must **echo**.
- Changing `save()` markup without a `deprecated` entry → every existing post shows "block invalid".
- Reading/writing post meta directly with `wp.data` instead of `useEntityProp` from `@wordpress/core-data`.
- Using `wp-blocks` or `core` as a namespace. Use `vendor/feature` (e.g. `my-plugin/card`).
- Forgetting `useBlockProps()` in `edit` — the block loses the alignment/className/anchor wrappers.
- Not declaring `"apiVersion": 3` in new blocks. In 7.0 one older block in a post dropped the iframe for the whole post; in 7.1 the iframe is forced, so older blocks that touch the global `document` break.
- Putting editor-side data in classic meta boxes. They still work in 7.1 but render outside the iframed canvas; prefer `register_post_meta( …, show_in_rest => true )` + `PluginDocumentSettingPanel`/`PluginSidebar` + `useEntityProp`.
- Using a 7.1 API (icons, responsive styles, `background.gradient`, Abilities `meta.public`) in code whose minimum WP is lower, without a guard.
- Writing code or docs that assume real-time collaboration, React 19 or a Gutenberg-plugin-only feature exists in core.
## Cross-reference jumps
- After scaffolding (`create-block.md`), proceed to `components.md` for the UI and `data.md` for store reads.
- Extending a core block (e.g. a custom attribute on `core/paragraph`) → `extending.md`, not `create-block.md`.
- `save()` returns `null` ⇒ dynamic-block territory ⇒ `dynamic-blocks.md`.
## Official docs root
https://developer.wordpress.org/block-editor/ — plus the Field Guides: [7.0](https://make.wordpress.org/core/2026/05/14/wordpress-7-0-field-guide/), [7.1](https://make.wordpress.org/core/2026/08/05/wordpress-7-1-field-guide/), and the [7.1.4 release notes](https://wordpress.org/documentation/wordpress-version/version-7-1-4/).
Pliki w paczce (15)
- LICENSE 1 KB
- README.md 7 KB
- SKILL.md 11 KB
- references/block-api.md 35 KB
- references/components.md 40 KB
- references/create-block.md 48 KB
- references/data.md 28 KB
- references/decision-tree.md 5 KB
- references/dynamic-blocks.md 30 KB
- references/extending.md 43 KB
- references/handbook-map.md 7 KB
- references/i18n.md 18 KB
- references/interactivity-api.md 35 KB
- references/patterns.md 20 KB
- references/theme-json.md 41 KB
Wersje
W bazie nie ma innych skilli o nazwie wp-block-editor.
Migawka bazy z 13.11.2026 · wersja paczki 5a1de7122f99 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 90wp-block-development
Przegląda bloki edytora WordPressa: block.json, komponenty edytora, zapis i renderowanie, InnerBlocks oraz Interactivity API. - 89wp-block-development
Przegląda kod bloków Gutenberga w WordPressie 6.x: schemat block.json, komponenty edytora, funkcje renderujące i użycie InnerBlocks. - 100wp-block-registration-and-assets
Tworzy i audytuje bloki WordPress rejestrowane przez block.json, kolekcje metadanych lub PHP autoRegister: register_block_type, API version 3, atrybuty, renderowanie dynamiczne, zasoby, block supports, deprecations, transformacje i warianty. - 95wordpress-developer
Pomaga tworzyć motywy, wtyczki i bloki WordPress: theme.json, Gutenberg, REST API, hooki i WP-CLI. - 90wp-block-development
Pomaga tworzyć bloki Gutenberga: plik block.json, atrybuty, renderowanie po stronie serwera, deprecations i budowanie projektu. - 100gutenberg-block-editor-security
Zabezpiecza dynamiczne bloki i funkcje edytora WordPress: sanityzuje atrybuty, escapuje wynik renderowania i sprawdza uprawnienia REST.