You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cac5df0
Browse filesBrowse the repository at this point in the historyBrowse files
Returns matching posts where the requested block appears anywhere in the
53
53
parsed block tree, including nested blocks.
54
54
55
-
To reduce unnecessary parsing on large datasets, the command first applies a coarse `post_content` prefilter when a safe marker is available, then confirms matches by parsing blocks.
55
+
To reduce unnecessary parsing on large datasets, the command first applies a
56
+
coarse `post_content` prefilter when a safe marker is available, then
57
+
confirms matches by parsing blocks. Candidate posts are loaded in batches to
At least one search filter is required: `--block`, `--block-namespace`, `--style`, `--pattern`, `--pattern-namespace`, or `--synced-pattern`.
61
+
At least one search filter is required: `--block`, `--block-namespace`,
62
+
`--style`, `--pattern`, `--pattern-namespace`, or `--synced-pattern`.
58
63
59
-
Pattern filters match embedded block metadata stored in `metadata.patternName`.
64
+
Pattern filters match only blocks whose own `metadata.patternName` matches.
60
65
61
-
The `--synced-pattern` filter matches reusable block references by synced pattern post ID.
66
+
The `--synced-pattern` filter matches reusable block references by synced
67
+
pattern post ID, and cannot be combined with `--block` or `--block-namespace`.
62
68
63
69
**OPTIONS**
64
70
65
71
[--block=<block-name>]
66
-
Block type name to search for (for example, 'core/paragraph').
72
+
Block type name to search for (for example, 'core/paragraph'). A name without a namespace is treated as a core block.
67
73
68
74
[--block-namespace=<block-namespace>]
69
75
Limit matches to blocks within a specific namespace (for example, 'core').
@@ -80,12 +86,23 @@ The `--synced-pattern` filter matches reusable block references by synced patter
80
86
[--synced-pattern=<post-id>]
81
87
Limit matches to reusable block references for a specific synced pattern post ID.
82
88
83
-
Note: `--block` and `--block-namespace` are mutually exclusive. `--pattern` and `--pattern-namespace` are also mutually exclusive.
89
+
[--limit=<limit>]
90
+
Stop after this many matching posts, in query order (post ID ascending unless
91
+
`--orderby` is given). Unlike `--posts_per_page`, which limits the candidate
92
+
posts examined, this counts matches. Cannot be combined with `--paged`.
84
93
85
94
[--<field>=<value>]
86
-
One or more args to pass to WP_Query.
95
+
One or more args to pass to WP_Query. The default `post_type` is `any`,
96
+
which excludes `wp_block` and other post types that are not searchable.
97
+
Pass `--post_type=wp_block` to search them explicitly.
98
+
99
+
Results are complete by default; candidate posts are processed in batches
100
+
internally. Pass `--posts_per_page=<n>` and `--paged=<n>` to search only
101
+
that window of candidate posts.
87
102
88
-
Use native WP_Query pagination args `--posts_per_page=<n>` and `--paged=<n>` to scan large sites in smaller batches. These args limit the candidate posts examined for a given run; they do not add pagination metadata to the command output. Results in each page may not be equal and empty response isn't guarantee that next page won't have results.
103
+
Content inside synced patterns is not searched through `core/block`
104
+
references, so a block that only exists inside a synced pattern is not
105
+
found in the posts that use that pattern.
89
106
90
107
[--field=<field>]
91
108
Prints the value of a single field for each matching post.
@@ -125,46 +142,55 @@ These fields are optionally available:
125
142
**EXAMPLES**
126
143
127
144
# Find posts using the paragraph block.
128
-
$ wp block search --block=core/paragraph
145
+
$ wp block search --block=core/paragraph
146
+
147
+
# Find any post type posts using the heading block.
0 commit comments