Skip to content

WP-CLI Command: wp block pattern search #214

@TeemuSuoranta

Description

@TeemuSuoranta

This command would search through posts and find instances where pattern is used (same idea as in #212).

Example usage:

wp block pattern search --name=wpdocs/my-example

You should be also able to limit post type:

wp block pattern search --name=wpdocs/my-example --post-type=page

The command wp post list includes example implementation of passing query arguments, return fields and format so it's good benchmark for this.

Note that results may be incomplete as patterns can be detached etc but with current pattern name metadata in post content this is doable to a degree where command like this would be useful.

Use case: Find real examples from a project where certain patterns are used. This matters when checking styling, when refactoring or when it's safe to remove obsolete patterns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions