跳转到主要内容

产品标签 API

列出产品标签

GET /products/tags
属性 类型 必需 描述
context 字符串 否 发送请求的范围;决定响应中包含的字段。
page 整数 否 集合的当前页。默认为 1。
per_page 整数 否 结果集中返回的最大项目数。默认为无限制。允许的值在 0 和 100 之间。
search 字符串 否 限制结果,仅包含匹配的字符串。
exclude 数组 否 确保结果集排除特定的 ID。
include 数组 否 限制结果集为特定的 ID。
order 字符串 否 升序或降序排序。允许的值:asc, desc。默认为 asc。
orderby 字符串 否 按属性排序。允许的值:name, slug, count。默认为 name。
hide_empty 布尔值 否 如果为 true,则不返回空项。默认为 true。
curl "https://example-store.com/wp-json/wc/store/v1/products/tags"

示例响应:

[
	{
		"id": 1,
		"name": "Test Tag",
		"slug": "test-tag",
		"description": "",
		"parent": 0,
		"count": 1
	},
	{
		"id": 2,
		"name": "Another Tag",
		"slug": "another-tag",
		"description": "",
		"parent": 0,
		"count": 1
	}
]