This command would search through posts and find instances where block is used.
Likely not using WP_Query but checking in SQL query from post_content would be more performant althoguh WP_Query would be much more extendable.
Example usage:
wp block type search --name=core/accordion
This could lend itself to block styles too:
wp block type search --name=core/image --style=circle
You should be also able to limit post type:
wp block type search --name=core/accordion --post-type=page
And probably limit results:
wp block type search --name=core/accordion --limit=100
As what results this would return I'm a bit unsure.
Often I would like to see table with post id, post title, permalink and maybe post status.
The command wp post list includes example implementation of passing query arguments, return fields and format so it's good benchmark for this.
Use case: Find real examples from a project where certain blocks/block styles are used. This matters when checking styling, when refactoring or when it's safe to remove obsolete blocks.
This command would search through posts and find instances where block is used.
Likely not using WP_Query but checking in SQL query from post_content would be more performant althoguh WP_Query would be much more extendable.
Example usage:
This could lend itself to block styles too:
You should be also able to limit post type:
And probably limit results:
As what results this would return I'm a bit unsure.
Often I would like to see table with post id, post title, permalink and maybe post status.
The command
wp post listincludes example implementation of passing query arguments, return fields and format so it's good benchmark for this.Use case: Find real examples from a project where certain blocks/block styles are used. This matters when checking styling, when refactoring or when it's safe to remove obsolete blocks.