convert-from-blocks Convert from Blocksconvert-post-to-blocks Convert Post to Blocksconvert-to-blocks Convert to Blocksget-pattern-guide Get Pattern Guiderepair-sourced-attributes Repair Sourced AttributesConverts Gutenberg block markup, such as the raw post_content of a post, into HTML or Markdown, and returns it without saving anything. The mirror of convert-to-blocks: use it to read an existing block-based post into an editable format, revise it, and convert it back into equivalent blocks. The result reports block_count and any conversion diagnostics. Requires edit_posts.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | Yes | Existing Gutenberg block markup (e.g. a post's raw post_content) to convert. | |
target_format | string | Yes | Format to convert the block markup into. One of: html, markdown. | |
options | object | No | Optional passthrough context for the transformer (e.g. strict/allow_fallbacks). |
Converts the raw-HTML post_content of existing posts into native Gutenberg block markup and saves it, in one server-side step, using the same conversion as convert-to-blocks. Takes only post IDs, so the converted markup never passes through the caller, and works on any post type. Each ID is handled on its own: an ID the caller cannot edit is refused, a post that already contains block markup or has empty content is skipped, and the rest of the batch carries on. Any post whose status is not draft, pending or auto-draft (published, private, scheduled, or a custom status) is treated as live and refused unless confirmed is true on the same call, so review what will change first. Returns one result per ID, with block_count and fallback_count for each converted post so any generic group or html fallbacks can be reviewed afterwards; fallbacks never block the save. Requires edit_posts, plus edit_post on each post.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ids | array of integer | Yes | Post IDs to convert. Works on any post type. | |
confirmed | boolean | No | Required to be true for this call to convert any live post among the given IDs – any status other than draft, pending or auto-draft. Ignored for those three, which never need it. |
Converts HTML or Markdown into native Gutenberg block markup suitable for post_content, and returns it without saving anything. Use source_format html for anything needing layout, media, buttons or styling; Markdown cannot express the shapes that produce the richer blocks, so keep it for plain prose. The result reports block_count, and lists in fallbacks every element that could not be matched to a specific block and was degraded to a generic group or html block, with its source tag, CSS selector and sanitized HTML. Call get-pattern-guide first to learn which HTML and CSS shapes produce cover, columns, media-text and buttons blocks. To convert and save an existing post, use convert-post-to-blocks rather than passing this output to another ability by hand. Requires edit_posts.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | Yes | The HTML or Markdown source content to convert. | |
source_format | string | Yes | Format of the supplied content. Use "html" for anything needing layout, styling, media, buttons, or other structure markdown cannot express; use "markdown" for plain prose. One of: html, markdown. | |
options | object | No | Optional passthrough context for the transformer (e.g. strict/allow_fallbacks). |
Returns reference data for convert-to-blocks: the plain elements that convert directly, the HTML and CSS shapes that produce the richer blocks (cover, columns, media-text and buttons) with an example of each in priority order, and how content matching neither is reported as a fallback. Call it before writing HTML meant to produce a specific block, rather than guessing at markup and checking fallback_count afterwards. Takes no input. Requires edit_posts.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
_ | string | No | Unused. Present only to satisfy the abilities adapter, which rejects a truly empty input schema. |
Removes sourced attributes, such as the rich-text content of paragraph, heading and list-item blocks, from the block comment delimiters of existing posts, and saves the result. The block editor reads these attributes from the saved HTML and never writes them into the delimiter; when they are there, WordPress raises a rest_validate_value_from_schema notice every time the block renders. Use it on block content written by older converters that carry them. Takes only post IDs and works on any post type. Only the delimiter JSON changes; the saved HTML is left exactly as it is. Each ID is handled on its own: an ID the caller cannot edit is refused, and a post with no block markup or nothing to remove is skipped. Any post whose status is not draft, pending or auto-draft (published, private, scheduled, or a custom status) is treated as live and refused unless confirmed is true on the same call. Returns one result per ID, with attributes_removed for each repaired post. Requires edit_posts, plus edit_post on each post.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ids | array of integer | Yes | Post IDs to repair. Works on any post type. | |
confirmed | boolean | No | Required to be true for this call to repair any live post among the given IDs – any status other than draft, pending or auto-draft. Ignored for those three, which never need it. |