架构

架构定义了模式目录项记录中存在的所有字段。除非使用了 `_filter` 查询参数,或者该架构字段仅出现在特定上下文中,否则这些端点的任何响应都应包含以下字段。

id 模式 ID。

JSON 数据类型:整数

上下文:view, edit, embed

title 模式标题,采用人类可读格式。

JSON 数据类型:字符串

上下文:view, edit, embed

content 模式内容。

JSON 数据类型:字符串

上下文:view, edit, embed

categories 模式的分类标识符(slug)。

JSON 数据类型:数组

上下文:view, edit, embed

keywords 模式的关键词。

JSON 数据类型:数组

上下文:view, edit, embed

description 模式的描述。

JSON 数据类型:字符串

上下文:view, edit, embed

viewport_width 预览模式时首选的视口宽度,单位为像素。

JSON 数据类型:整数

上下文:view, edit, embed

block_types 可使用此模式的区块类型。

JSON 数据类型:数组

上下文:view, embed

列出模式目录项

查询此端点以检索模式目录项集合。您可以使用以下 URL 查询参数来控制接收到的响应并进行过滤。

定义

GET /wp/v2/pattern-directory/patterns

示例请求

$ curl https://example.com/wp-json/wp/v2/pattern-directory/patterns

参数

context 请求的作用域;决定响应中存在的字段。

默认值:view

可选值:view, embed, edit

page 当前页码。

默认值:1

per_page 结果集中返回的最大项目数。

默认值:100

search 限制结果仅包含匹配指定字符串的项目。
category 限制结果仅包含匹配指定分类 ID 的项目。
keyword 限制结果仅包含匹配指定关键词 ID 的项目。
slug 限制结果仅包含匹配指定模式(slug)的项目。
offset 从结果集中跳过指定数量的项目。
order 排序属性为升序或降序。

默认值:desc

可选值:asc, desc

orderby 按帖子属性对集合进行排序。

默认值:date

可选值:author, date, id, include, modified, parent, relevance, slug, include_slugs, title, favorite_count