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 -->