-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
From wp-cli/ideas#119
Some more concrete ideas:
wp post has-blocks <id>- Whether the post has any blocks. Uses thehas_blocks()function.wp post has-block <id> <block>- Whether the post contains any specific block type. Uses thehas_block()function.- Add a new
block_versionfield towp post getthat usesblock_version() wp block list- List all registered block types (WP_Block_Type_Registry)wp block get <block>- Get information about a specific registered block type (WP_Block_Type)wp block parse <id>- Runparse_blocks()on a specific post ID and return the raw JSON tree structure.wp block render <id>- Rundo_blocks()to render the specific blocks of a post and return the final HTML.wp pattern list [--category=<cat>]- List all registered block patterns (WP_Block_Patterns_Registry).wp pattern get <id>- Get a specific block pattern
Notes:
- This functionality was added in WordPress 5.0+, but we still support WordPress 4.9. Thus, we need to make these commands available only conditionally, for example with a
before_invokehook and an appropriate error message.
Copilot