Note: This command is not part of a stable WP-CLI release yet. To use it now, switch to the nightly build with wp cli update --nightly. If you installed the command as a separate package, updating that package may be enough.
Provides commands for inspecting, manipulating, and managing Gutenberg blocks in post content.
Examples
# List all blocks in a post.
$ wp post block list 123
+------------------+-------+
| blockName | count |
+------------------+-------+
| core/paragraph | 2 |
| core/heading | 1 |
+------------------+-------+
# Parse blocks in a post to JSON.
$ wp post block parse 123 --format=json
# Insert a paragraph block.
$ wp post block insert 123 core/paragraph --content="Hello World"
Subcommands
| Name | Description |
|---|---|
| wp post block clone | Clones a block within a post. |
| wp post block count | Counts blocks across multiple posts. |
| wp post block export | Exports block content to a file. |
| wp post block extract | Extracts data from blocks. |
| wp post block get | Gets a single block by index. |
| wp post block import | Imports blocks from a file into a post. |
| wp post block insert | Inserts a block into a post at a specified position. |
| wp post block list | Lists blocks in a post with counts. |
| wp post block move | Moves a block from one position to another. |
| wp post block parse | Parses and displays the block structure of a post. |
| wp post block remove | Removes blocks from a post by name or index. |
| wp post block render | Renders blocks from a post to HTML. |
| wp post block replace | Replaces blocks in a post. |
| wp post block update | Updates a block’s attributes or content by index. |