Writing serialized Gutenberg blocks in PHP

You can use the get_comment_delimited_block_content function to serialize Gutenberg syntax in a way that correctly shows as blocks in the editor.

Sometimes you want to append to `post_content` in PHP.

You can use the get_comment_delimited_block_content function to serialize Gutenberg syntax in a way that correctly shows as blocks in the editor:

$post_content .= get_comment_delimited_block_content(
'block_name',
[
'attribute' => $value,
],
'<p>' . $content . '</p>'
);

Follow the thread

Start here

Eight essays connecting disciplines, useful progress, and deliberate choices.

Writing archive

Browse the complete archive, including technical, personal, travel, and book writing.

Projects

Tools and experiments where the ideas meet practical work.

Leave a Reply

Discover more from Artur Piszek

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Artur Piszek

Subscribe now to keep reading and get access to the full archive.

Continue reading