Block Deprecation Secrets Only WordPress Experts Know
๐ **Source:** [Block Deprecation Secrets Only WordPress Experts Know](https://www.youtube.com/watch?v=nE3tXm4qkFs)
> [!note]+ Document Notes
> tags:
> - #WordPress
> - #Gutenberg
> - #BlockDeprecation
> Author: Presenter not specified in transcript (channel/author name not stated)
> Source: YouTube (video tutorial)
> Reference: https://www.youtube.com/watch?v=nE3tXm4qkFs
> date created: 2025-08-20 11:56
>
> # ๐งฉ Title: Block Deprecation Secrets Only WordPress Experts Know โ A Practical Walkthrough
>
<!-- deep-read:sections start -->
## ๐งญ Table of Contents:
- [๐ Summary](#-summary)
- [๐ Main Content](#-main-content)
- [๐๏ธ Notes](#๏ธ-notes)
- [๐ References](#-references)
- [๐ฃ๏ธ Paraphrase](#-paraphrase)
- [๐ฐ Newsletter](#-newsletter)
- [โ
Action Items](#-action-items)
- [๐งช Hypotheses](#-hypotheses)
- [๐ Methodology](#-methodology)
- [โ Questions](#-questions)
- [๐ฎ Future Research](#-future-research)
- [๐ก Implications](#-implications)
- [๐ง Learning Styles Assessment](#-learning-styles-assessment)
- [โฟ Accessibility Assessment](#-accessibility-assessment)
- [๐ DEIB Assessment](#-deib-assessment)
- [๐งฎ Logical Validity](#-logical-validity)
- [๐ก๏ธ DARVO Analysis](#-darvo-analysis)
- [๐ SEO Evaluation](#-seo-evaluation)
- [๐ฏ Conclusion](#-conclusion)
### ๐ References: Include a list of sources consulted and cited in the article.
## ๐ Summary:
- ๐น **What it is:** A hands-on demo that shows how to prevent and fix block validation errors by using **block deprecations** in WordPress.
- ๐น **Scenario:** You inherit a static **recipe** block, then change its markup, add a `title` attribute, rename it to `name`, and later convert hardcoded markup to **InnerBlocks**.
- ๐น **Core lesson:** Keep a **`deprecated` array** for prior versions. Include the **old `save()`** and **old `attributes`**, and optionally a **`migrate()`** to transform data.
- ๐น **Why it matters:** You avoid the โThis block contains unexpected or invalid contentโ error across many posts and keep editors happy.
## ๐ Main Content:
- ๐น **Setup & aim** ([0:00](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=0)โ[0:40](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=40))
- ๐ธ Presenter introduces **block deprecations** and prepares a sandbox plugin.
- ๐ธ Goal: Show markup changes, attribute changes, and InnerBlocks migration without breaking existing content.
- ๐น **Baseline static block** ([1:10](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=70)โ[1:47](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=107))
- ๐ธ โGreatest chocolate chip cookie recipeโ renders as simple static markup.
- ๐ธ No attributes yet; everything is hardcoded.
- ๐น **First change: markup toggle** ([1:50](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=110)โ[3:04](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=184))
- ๐ธ Replace recipe content in **`edit.js`** and **`save.js`** to add show/hide behavior.
- ๐ธ Refresh causes a **validation error** because new **`save()`** output โ saved post HTML.
- ๐น **Add a deprecation for markup** ([4:23](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=263)โ[6:46](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=406))
- ๐ธ Create **`deprecations.js`** with an array of versions.
- ๐ธ Add an entry with the **old `save()`** and **old `attributes`** (none yet).
- ๐ธ After rebuild and refresh, the error clears; the editor can reconcile versions.
- ๐น **Add `title` attribute with RichText** ([7:57](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=477)โ[10:15](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=615))
- ๐ธ Introduce `attributes.title` in **`block.json`**.
- ๐ธ Swap `<h2>` with **`RichText`** in `edit.js` and **`RichText.Content`** in `save.js`.
- ๐ธ Save a custom title; everything still validates.
- ๐น **Rename attribute: `title` โ `name`** ([10:55](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=655)โ[14:33](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=873))
- ๐ธ Update **`block.json`**, `edit.js`, `save.js`.
- ๐ธ Refresh yields **another validation error** because stored posts still have `title`.
- ๐ธ Fix by adding a **second deprecation entry** that lists old `attributes` and uses **`migrate({ title }) => ({ name: title })`**.
- ๐น **Convert hardcoded sections to InnerBlocks** ([15:45](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=945)โ[20:20](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=1220))
- ๐ธ Build a **template** with two `core/details` blocks each containing a `core/list`.
- ๐ธ In `edit.js`, render `<InnerBlocks template=[โฆ] allowedBlocks=['core/details','core/list'] />`.
- ๐ธ In `save.js`, render `<InnerBlocks.Content />`.
- ๐ธ If a validation error occurs, add a **third deprecation** that replays old hardcoded markup and uses **`migrate(_, innerBlocks)`** to **create** list items and **return** `{ name, innerBlocks }`.
- ๐น **Takeaways** ([20:33](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=1233)โ[21:08](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=1268))
- ๐ธ Deprecations are normal for **static** blocks; dynamic blocks donโt need them.
- ๐ธ Gather the old `save()` and `attributes` **before** refactors.
### ๐๏ธ Notes
- ๐น **Block validation error โ cause & fix**
- ๐ธ Cause: new **`save()`** output doesnโt **match** the old post HTML ([3:04](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=184)โ[4:05](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=245)).
- ๐ธ Fix: add **deprecation entries** with the **previous** `attributes` and **previous** `save()`.
- ๐ธ Optional: write **`migrate(attributes, innerBlocks)`** to transform data across versions.
- ๐น **Workflow pattern**
- ๐ธ โ
**Before** changing markup: copy the old `save()` into `deprecations`.
- ๐ธ โ
For attribute renames: keep old **shape** in `attributes`, then map in `migrate`.
- ๐ธ โ
For markup โ InnerBlocks: reconstruct blocks in `migrate` and return `innerBlocks`.
- ๐น **RichText swap** ([7:57](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=477)โ[10:15](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=615))
- ๐ธ `edit.js`: `RichText tagName="h2" value={attributes.title} onChange={(v)=>setAttributes({ title:v })}`.
- ๐ธ `save.js`: `<RichText.Content tagName="h2" className="โฆ" value={attributes.title} />`.
- ๐น **Attribute rename** ([10:55](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=655)โ[14:33](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=873))
- ๐ธ Old: `title:string`, New: `name:string`.
- ๐ธ Deprecation: `attributes:{ title:{type:'string',default:'Classicโฆ'} }`, `save()` uses `title`.
- ๐ธ `migrate({title}){ return { name:title }; }`.
- ๐น **InnerBlocks migration** ([15:45](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=945)โ[19:18](https://www.youtube.com/watch?v=nE3tXm4qkFs&t=1158))
- ๐ธ Build arrays of **created** `core/list-item` blocks from prior content.
- ๐ธ Create two parent `core/details` blocks with those items as children.
- ๐ธ Return `{ name, innerBlocks:[โฆdetails blocksโฆ] }` from `migrate`.
- ๐น **Tone & style**
- ๐ธ Conversational, pragmatic, slightly cheeky (โshut up, itโs my templateโ).
- ๐ธ Teaches by doing; shows failures, then fixes.
- ๐ธ Bias: favors **static** blocks to demo deprecations; notes dynamic as an escape hatch.
## ๐ References:
- ๐น Video transcript source: https://www.youtube.com/watch?v=nE3tXm4qkFs
- ๐น WordPress Docs โ Block Deprecation (concept + examples): https://developer.wordpress.org/news/2023/03/block-deprecation-a-tutorial/
- ๐น Block Editor Handbook โ Deprecation API: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/
- ๐น Block Editor Handbook โ `RichText`: https://developer.wordpress.org/block-editor/reference-guides/richtext/
- ๐น WP.org Doc โ โUnexpected or invalid contentโ overview: https://wordpress.org/documentation/article/block-error-unexpected-or-invalid-content/
- ๐น GitHub discussion โ using `migrate` with `innerBlocks`: https://github.com/WordPress/gutenberg/discussions/37744
## ๐ฃ๏ธ Paraphrase:
- ๐น **Why the first error appears**
- ๐ธ Original: The **`save.js`** output doesnโt match the existing post HTML, so the editor throws a validation error.
- ๐ธ Paraphrase: The editor compares the current **`save()`** render to the old stored HTML. If they differ, it flags the block as invalid.
- ๐น **What a deprecation actually does**
- ๐ธ Original: A `deprecated` entry tells the editor how the block **used to** look and how to map it forward.
- ๐ธ Paraphrase: You ship a time capsule of prior versions. The editor uses it to translate old content into the new shape.
## ๐ฐ Newsletter:
- ๐น **Learn web dev:** Todayโs bite is all **Gutenberg deprecations**. Youโll keep editors calm and content safe.
- ๐น **Updates:** We walk through markup refactors, attribute renames, and **InnerBlocks** migrations without nuking posts.
- ๐น **Community:** Share your best `migrate()` snippets in the #core-editor channel or forums.
- ๐น **Plugins:** If your static blocks keep changing, consider a **dynamic** version for stability.
- ๐น **Links:** Tutorial video โ https://www.youtube.com/watch?v=nE3tXm4qkFs โข Docs โ https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/
## โ
Action Items:
- ๐น **Reusable evaluation prompt (aligned to your advocacy + OSPO path):**
- ๐ธ โEvaluate how this resource supports **open-source contributor onboarding** in WordPress. Map takeaways to:
1) contributor education for **block authors**,
2) **transparency** in change management (changelogs, deprecations),
3) **sustainability** via reduced editor friction,
4) materials for **Learn WordPress**,
5) OSPO-aligned governance: migration policies, versioning, and support windows.
Produce TL;DR, contributor tasks, KPIs (invalid-block rate, time-to-fix), DEIB notes, and risks.โ
- ๐น **Do next (program + edu):**
- ๐ธ Publish a **Learn WordPress** lesson: โDeprecations 101 with `migrate()` and `InnerBlocks`.โ
- ๐ธ Add a **repo policy**: every breaking change must include **deprecation + migration** and a screenshot/GIF.
- ๐ธ Set a **KPI**: reduce โunexpected/invalid contentโ occurrences by **30%** quarter-over-quarter across sample sites.
- ๐ธ Create a **reference cookbook** of attribute rename patterns (`title`โ`name`, etc.) with tests.
## ๐งช Hypotheses:
- ๐น H1: Shipping deprecations with each markup change cuts invalid-block errors by **โฅ40%** within two releases.
- ๐น H2: A shared `migrate()` snippet library raises successful migrations by **โฅ25%** for first-time block authors.
- ๐น H3: Publishing an a11y-safe InnerBlocks template improves editor success rates by **โฅ15%**.
### ๐ Methodology:
- ๐น **Design:** Pre/post analysis on pilot plugins across 10โ20 client sites.
- ๐น **Data:** Site health logs, editor error telemetry, GitHub issues, support tickets.
- ๐น **Analysis:** Interrupted time series; classify failures by **markup**, **attribute**, **innerBlocks**.
### โ Questions:
- ๐น Which deprecation patterns cover **80%** of real-world block refactors?
- ๐น When should teams stop deprecating and ship a **new** block name instead?
- ๐น How can we auto-generate `deprecated` entries from diffs?
### ๐ฎ Future Research:
- ๐น Build a **CLI** that snapshots `save()` + `attributes` before refactors and scaffolds `deprecated` entries.
- ๐น Explore **dynamic** fallbacks for frequently-changing blocks to reduce deprecation churn.
- ๐น Study editor UX cues that guide users during migrations.
### ๐ก Implications:
- ๐น Better deprecation hygiene cuts support costs and editor frustration.
- ๐น OSPOs can treat block migrations as **governance artifacts**, improving trust and transparency.
### ๐ง Learning Styles Assessment:
- ๐น **Readability:** Conversational technical tutorial; ~Grade **9โ10**.
1. ๐น **Visual (Spatial)**
- ๐ธ Present: On-screen code changes implied; minimal diagrams.
- ๐ธ Improve: Add flowcharts for **before/after** `save()` and `migrate()`.
2. ๐น **Aural (Auditory)**
- ๐ธ Present: Spoken walkthrough.
- ๐ธ Improve: Provide a short audio recap and chaptered timestamps.
3. ๐น **Verbal (Linguistic)**
- ๐ธ Present: Step-by-step narration with examples.
- ๐ธ Improve: Glossary for `deprecated`, `migrate`, `InnerBlocks`.
4. ๐น **Physical (Kinesthetic)**
- ๐ธ Present: Live coding pace invites replication.
- ๐ธ Improve: Downloadable repo + exercises per step.
5. ๐น **Logical (Mathematical)**
- ๐ธ Present: Clear cause โ effect (mismatch โ error โ deprecate).
- ๐ธ Improve: Decision tree: **deprecate vs new block vs dynamic**.
6. ๐น **Social (Interpersonal)**
- ๐ธ Present: Tutorial-only.
- ๐ธ Improve: Link to discussion threads and office hours.
7. ๐น **Solitary (Intrapersonal)**
- ๐ธ Present: Transcript aids self-study.
- ๐ธ Improve: Self-check prompts after each refactor.
8. ๐น **Naturalistic**
- ๐ธ Present: Not applicable.
- ๐ธ Improve: N/A.
### ๐ Accessibility Assessment:
- ๐น **Screen Reader:** Ensure semantic headings in show notes; label code blocks.
- ๐น **Keyboard:** Provide focus-visible states in example UIs; avoid tab traps in details/summary demos.
- ๐น **Contrast:** Use WCAG 2.2 AA in code overlays; avoid low-contrast comments.
- ๐น **Text Resizing:** Make code panes responsive and scrollable at 200โ400% zoom.
### ๐ DEIB Assessment:
- ๐น **Cultural Relevance:** Technical focus; broaden examples to teams of varied sizes and regions.
- ๐น **Inclusive Language:** Avoid jargon without definitions; keep tone respectful and welcoming.
- ๐น **Neurodiversity:** Chunk steps; add checklists and predictable patterns.
- ๐น **Representation:** Invite community examples from diverse contributors.
- ๐น **Psychological Safety:** Normalize mistakes; show non-punitive recovery paths.
### ๐งฎ Logical Validity:
- ๐น **Sound reasoning:**
- ๐ธ *Causal chain:* New markup/attributes โ mismatch โ validation error โ deprecations + migration resolve it.
- ๐ธ *Consistency:* Same rules applied across markup, attribute rename, and InnerBlocks.
- ๐ธ *Counterexample covered:* Dynamic blocks donโt store HTML; they avoid these errors.
- ๐น **Potential gaps:**
- ๐ธ No formal data on error rates; future work should add metrics.
- ๐น **Tone of voice:**
- ๐ธ Practical, humorous, candid about pain points; focuses on fixes, not blame.
- ๐น **Fallacy scan:**
- ๐ธ No strawman or false dilemma; the tutorial compares **deprecate**, **recover**, and **dynamic** calmly.
## ๐ก๏ธ DARVO Analysis:
- ๐น **Deny:** Not present. The tutorial openly acknowledges errors and shows them on-screen.
- ๐น **Attack:** Not present. No personal attacks or blame; critique stays on code and process.
- ๐น **Reverse Victim and Offender:** Not present. The editor is not framed as the villain; the mismatch is the issue.
- ๐น **Notes:** Language remains instructive and empathetic; no DARVO tactics appear.
### ๐ SEO Evaluation:
1. ๐น **Keywords:** โWordPress blocks,โ โGutenberg deprecations,โ โblock validation error,โ โInnerBlocks migration.โ
2. ๐น **Meta description:** Add a 150โ160 char summary including โGutenberg deprecationsโ and โmigrate.โ
3. ๐น **Title tag:** Keep under 60 chars; include โWordPress Blocksโ + โDeprecationsโ.
4. ๐น **Headers:** Use H2/H3 for โMarkup change,โ โAttribute rename,โ โInnerBlocks migration.โ
5. ๐น **Length:** Aim for 1,200โ1,800 words in show notes with clear sections.
6. ๐น **Links:** Internal links to related block tutorials; external links to WP docs.
7. ๐น **URL:** Use concise slug, e.g., `/gutenberg-block-deprecations-migrate`.
8. ๐น **Images:** Include step diagrams; add descriptive **alt** text and compressed assets.
9. ๐น **Mobile:** Optimize video embed; lazy-load iframes.
10. ๐น **Engagement:** Add โTry itโ checklists and code snippets.
11. ๐น **Schema:** Use `VideoObject` + `Article`; add timestamps via `Clip` markup if possible.
12. ๐น **Social:** Provide Open Graph image with code overlay; set Twitter Card to `summary_large_image`.
## ๐ฏ Conclusion:
- ๐น **Bottom line:** Deprecations prevent chaos when blocks evolve.
- ๐น **Playbook:** Save the **old** `save()` and `attributes`, write **`migrate()`** when shapes change, and consider **InnerBlocks** for flexibility.
- ๐น **Outcome:** Fewer invalid blocks, smoother editor experience, and a maintainable upgrade path for teams and clients.
<!-- deep-read:sections end -->