本文档介绍了 WordPress REST API 中小部件类型的 Schema 定义和端点操作,包括字段结构和如何通过 API 检索小部件类型信息。
GET /wp/v2/widget-types
$ curl https://example.com/wp-json/wp/v2/widget-types
GET /wp/v2/widget-types/<id>
$ curl https://example.com/wp-json/wp/v2/widget-types/<id> The schema defines all the fields that exist within a widget type record. Any response from these endpoints can be expected to contain the fields below unless the `_filter` query parameter is used or the schema field only appears in a specific context.
id
|
Unique slug identifying the widget type.
JSON data type: string Read only Context: |
name
|
Human-readable name identifying the widget type.
JSON data type: string Read only Context: |
description
|
Description of the widget.
JSON data type: string Context: |
is_multi
|
Whether the widget supports multiple instances
JSON data type: boolean Read only Context: |
classname
|
Class name
JSON data type: string Read only Context: |
GET /wp/v2/widget-types
Query this endpoint to retrieve a specific widget type record.
$ curl https://example.com/wp-json/wp/v2/widget-types
context
|
Scope under which the request is made; determines fields present in response.
Default: One of: |
GET /wp/v2/widget-types/<id>
Query this endpoint to retrieve a specific widget type record.
$ curl https://example.com/wp-json/wp/v2/widget-types/<id>
id
|
The widget type id. |
context
|
Scope under which the request is made; determines fields present in response.
Default: One of: |