Open ellatrix opened 1 month ago
Another further thought on opt-in / opt-out: we could add a flag in wp_config
: AUTO_CONVERT_TO_BLOCKS
which could support a post type array argument.
Been looking / thinking about this a bit and have few questions/comments:
core/freeform
blocks can be made permanent, i.e. saved in the DB as any other block. Thinking this will still make it possible to not run autop on every page load on the front-end which will be a very nice speed improvement.Let's say we run a multisite. There can be various combinations among sites: a) run Gutenberg and have posts, pages (use block themes); b) run Gutenberg but use ACF on Custom Post types, c) run legacy themes with Classic editor on posts and pages.
I understand that suggested option AUTO_CONVERT_TO_BLOCKS
would affect only group A. And for group C, only after migration to block themes this would start making impact.
As conversion to blocks is inevitable, this might not cause any real problem.
However there can be some situations to consider:
core/group
and core/html
are good examples for cases when we want to enforce brand styles and leave editors with certain and custom layouting means. When talking about statistics of conversion failure - <div>
is a major issue when core/group
and core/html
blocks are not available.What would be very helpful with AUTO_CONVERT_TO_BLOCKS
introduction is that we could mark all these posts as failing. And further maybe alert via log or email. The editors or authors might initiate the auto convert, but the administrators are ones to solve the issues. So flagging failing auto conversions would make a more efficient discovery.
Let's slowly try to auto convert classic content to blocks.
Ideas from @mtias: let's start small, don't do it for post types without revisions, maybe opt-in for non-exact conversions.
To do list:
isEquivalentHTML
to compare the content without whitespace.div
elements togroup
(use a raw transform in block.json). Maybe even include other tags because the group block supports a custom tag name. Also match class name etc.id
on a paragraph etc.Cc @azaozz @mtias