Gutenberg Tools
Gutenberg tools read and write block-based content. Available on all plans.
| Tool | Description |
|---|---|
wp_get_blocks | Get blocks for a page or post |
wp_set_blocks | Set blocks (HTML string or parsed array) |
wp_patch_block_section | Replace one block by client ID |
wp_list_block_types | All registered block types on this site |
wp_list_block_patterns | Available block patterns |
wp_parse_blocks | Parse raw HTML into block structure |
wp_serialize_blocks | Serialize block array back to HTML |
wp_validate_blocks | Validate structure without saving |
wp_get_block_design_system | Design system tokens (colors, fonts, spacing) |
Read blocks
Section titled “Read blocks”// wp_get_blocks — {"id": 42}Returns parsed block array + raw HTML.
Write blocks
Section titled “Write blocks”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."}} ]}Common block names
Section titled “Common block names”| Block | Name |
|---|---|
| Heading | core/heading |
| Paragraph | core/paragraph |
| Image | core/image |
| Button | core/button |
| Columns | core/columns |
| Group | core/group |
| List | core/list |
| Quote | core/quote |
| Separator | core/separator |
| Spacer | core/spacer |
| Table | core/table |
| Embed | core/embed |
Call wp_list_block_types to see all blocks on the specific site including plugin blocks.