Skip to content

Gutenberg Tools

Gutenberg tools read and write block-based content. Available on all plans.

ToolDescription
wp_get_blocksGet blocks for a page or post
wp_set_blocksSet blocks (HTML string or parsed array)
wp_patch_block_sectionReplace one block by client ID
wp_list_block_typesAll registered block types on this site
wp_list_block_patternsAvailable block patterns
wp_parse_blocksParse raw HTML into block structure
wp_serialize_blocksSerialize block array back to HTML
wp_validate_blocksValidate structure without saving
wp_get_block_design_systemDesign system tokens (colors, fonts, spacing)
// wp_get_blocks — {"id": 42}

Returns parsed block array + raw HTML.

Pass HTML:

{"id": 42, "content": "<!-- wp:heading {\"level\":1} --><h1>Title</h1><!-- /wp:heading --><!-- wp:paragraph --><p>Content.</p><!-- /wp:paragraph -->"}

Or pass a block array — the plugin serializes:

{
"id": 42,
"blocks": [
{"name": "core/heading", "attributes": {"content": "Title", "level": 1}},
{"name": "core/paragraph", "attributes": {"content": "Content here."}}
]
}
BlockName
Headingcore/heading
Paragraphcore/paragraph
Imagecore/image
Buttoncore/button
Columnscore/columns
Groupcore/group
Listcore/list
Quotecore/quote
Separatorcore/separator
Spacercore/spacer
Tablecore/table
Embedcore/embed

Call wp_list_block_types to see all blocks on the specific site including plugin blocks.