架构

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

date 文章发布的日期,使用站点时区。

JSON 数据类型:字符串或 null,
格式:datetime (详情)

上下文:view, edit, embed

date_gmt 文章发布的日期,使用 GMT 时间。

JSON 数据类型:字符串或 null,
格式:datetime (详情)

上下文:view, edit

guid 文章的全局唯一标识符。

JSON 数据类型:对象

只读

上下文:view, edit

id 文章的唯一标识符。

JSON 数据类型:整数

只读

上下文:view, edit, embed

link 文章的 URL。

JSON 数据类型:字符串,
格式:uri

只读

上下文:view, edit, embed

modified 文章最后修改的日期,使用站点时区。

JSON 数据类型:字符串,
格式:datetime (详情)

只读

上下文:view, edit

modified_gmt 文章最后修改的日期,使用 GMT 时间。

JSON 数据类型:字符串,
格式:datetime (详情)

只读

上下文:view, edit

slug 针对其类型唯一的文章字母数字标识符。

JSON 数据类型:字符串

上下文:view, edit, embed

status 文章的命名状态。

JSON 数据类型:字符串

上下文:view, edit, embed

其中之一:publish, future, draft, pending, private

type 文章类型。

JSON 数据类型:字符串

只读

上下文:view, edit, embed

password 用于保护访问内容和摘要的密码。

JSON 数据类型:字符串

上下文:edit

title 文章的标题。

JSON 数据类型:对象

上下文:view, edit, embed

content 文章的内容。

JSON 数据类型:对象

上下文:view, edit, embed

template 用于显示文章的模板文件。

JSON 数据类型:字符串

上下文:view, edit

列出导航

查询此端点以检索导航集合。您可以使用下面的 URL 查询参数来控制和处理接收到的响应。

定义

GET /wp/v2/navigation

示例请求

$ curl https://example.com/wp-json/wp/v2/navigation

参数

context 请求的范围;决定响应中存在的字段。

默认值:view

其中之一:view, embed, edit

page 集合的当前页码。

默认值:1

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

默认值:10

search 将结果限制为匹配某字符串的记录。
after 将响应限制为在给定 ISO8601 合规日期之后发布的文章。
modified_after 将响应限制为在给定 ISO8601 合规日期之后修改的文章。
before 将响应限制为在给定 ISO8601 合规日期之前发布的文章。
modified_before 将响应限制为在给定 ISO8601 合规日期之前修改的文章。
exclude 确保结果集排除特定的 ID。
include 将结果集限制为特定的 ID。
offset 偏移结果集指定的项目数量。
order 按升序或降序排序属性。

默认值:desc

其中之一:asc, desc

orderby 按文章属性对集合进行排序。

默认值:date

其中之一:author, date, id, include, modified, parent, relevance, slug, include_slugs, title

search_columns 要搜索的列名数组。
slug 将结果集限制为具有一个或多个特定 slug 的文章。
status 将结果集限制为分配了一个或多个状态的文章。

默认值:publish

创建导航

参数

date 文章发布的日期,使用站点时区。
date_gmt 文章发布的日期,使用 GMT 时间。
slug 针对其类型唯一的文章字母数字标识符。
status 文章的命名状态。
其中之一:publish, future, draft, pending, private
password 用于保护访问内容和摘要的密码。
title 文章的标题。
content 文章的内容。
template 用于显示文章的模板文件。

定义

POST /wp/v2/navigation

检索导航

定义 & 示例请求

GET /wp/v2/navigation/<id>

查询此端点以检索特定的导航记录。

$ curl https://example.com/wp-json/wp/v2/navigation/<id>

参数

id 文章的唯一标识符。
context 请求的范围;决定响应中存在的字段。

默认值:view

其中之一:view, embed, edit

password 如果文章受密码保护,则为文章的密码。

更新导航

参数

id 文章的唯一标识符。
date 文章发布的日期,使用站点时区。
date_gmt 文章发布的日期,使用 GMT 时间。
slug 针对其类型唯一的文章字母数字标识符。
status 文章的命名状态。
其中之一:publish, future, draft, pending, private
password 用于保护访问内容和摘要的密码。
title 文章的标题。
content 文章的内容。
template 用于显示文章的模板文件。

定义

POST /wp/v2/navigation/<id>

示例请求

无

删除导航

参数

id 文章的唯一标识符。
force 是否绕过回收站并强制删除。

定义

DELETE /wp/v2/navigation/<id>

示例请求

$ curl -X DELETE https://example.com/wp-json/wp/v2/navigation/<id>