Repository navigation
REST API: Add parsed blocks to the post content field. - #15835
adamsilverstein wants to merge 2 commits into
Conversation
Add `content.blocks` to post type responses, holding the post's blocks as parsed from the content, with keys matching the public properties of `WP_Block`. Like `content.raw`, the blocks carry raw stored markup, so they are only returned in the `edit` context. Parsing adds to every response, so they are also opt-in: the request has to name `content.blocks` in `_fields`. See #53603. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018vwYjWL8VuAH7kt7zZdZi4
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Apply the same Block Hooks to the content before parsing it, so `content.blocks` and `content.raw` describe the same tree, and return `content.blocks` from the revisions and autosaves endpoints, whose schemas already copy the field from the parent post type. Move the block conversion and the request check into private helpers in rest-api.php so both controllers share them. See #53603. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018vwYjV3Gi53g5ct8BDL5JE
|
@TimothyBJacobs before this goes much further, I'd love your read on the one design choice most likely to change it: using Claude laid out the tradeoff:
What do you think? |
Claude Code wrote this backport and its description, carried over from the Gutenberg PR:
Trac ticket: https://core.trac.wordpress.org/ticket/53603
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Code, tests and this description were written by Claude Code at my direction. I will review and test.