-
Notifications
You must be signed in to change notification settings - Fork 14
Pattern Directory Items
Arun Prakash edited this page Sep 21, 2025
·
1 revision
The WordPress Pattern Directory endpoint lists reusable block patterns from the directory.
- Endpoint:
GET /wp/v2/pattern-directory/patterns
- Typical query params:
search
,page
,per_page
,category
(ID),keyword
(ID),slug
,offset
,order
,orderby
(supportsfavorite_count
)
final res = await client.patternDirectory.query
.withSearch('hero')
.withOrder(Order.desc)
// "favorite_count" is supported by the Pattern Directory endpoint
.withOrderBy('favorite_count')
.withPerPage(10)
.execute();
res.map(
onSuccess: (s) {
for (final p in s.data) {
// p is PatternDirectoryItem
print('${p.id}: ${p.title}');
}
return null;
},
onFailure: (f) {
print('Failed: ${f.message ?? ''}');
return null;
},
);
final res = await client.patternDirectory.list(
ListPatternDirectoryItemsRequest(
search: 'hero',
perPage: 5,
order: Order.desc,
orderBy: OrderBy.favorite_count,
),
);
PatternDirectoryItem
fields include:
-
id
(int) -
title
(String) -
content
(String) -
description
(String?) -
categories
(List?) -
keywords
(List?) -
viewportWidth
(int?) -
blockTypes
(List?)
Note: This endpoint usually does not require authentication. Behaviors may vary by site configuration.