Blocks: Optional support that optimizes handling blocks for usage as structured data #49437
Labels
[Feature] Block API
API that allows to express the block paradigm.
[Feature] Blocks
Overall functionality of blocks
[Type] Feature
New feature to highlight in changelogs.
What problem does this address?
Related issues and PRs: #2649, #6494, #2649.
Related Trac tickets: 53603, 53602.
There are many ways how people use WordPress. One of them is to consume the content saved by the block editor as JSON. Let's explore whether we can add an optional built-in support that optimizes handling blocks for usage as structured data.
The default configuration optimizes the block editor to store the values assigned to block attributes in two ways:
save
function – that part we can only read on the client in WordPress core today because we need to know how to query those attributes and have a tool that would do it in PHP.There is an ongoing exploration (#46345) to build a tool that reads attributes sourced from HTML on the server with PHP, but it might only work in some specific cases. There are several limitations on how far we can go with that approach coming from the architectural decisions made in the past:
What is your proposed solution?
What if we offer an optional editor setting that enables a few optimizations that resolve the listed issues when consuming WordPress blocks as structured data?
Here are some initial ideas:
get_post
's$filter
parameter to allow block data as a return shape (Trac ticket).The text was updated successfully, but these errors were encountered: