スキーマ

スキーマはcategoryオブジェクトに存在するすべてのフィールドを定義しています。

id
integer

Unique identifier for the term.

読み取り専用

コンテキスト: view, embed, edit

count
integer

Number of published posts for the term.

読み取り専用

コンテキスト: view, edit

description
string

HTML description of the term.

コンテキスト: view, edit

name
string

HTML title for the term.

コンテキスト: view, embed, edit

slug
string

An alphanumeric identifier for the term unique to its type.

コンテキスト: view, embed, edit

taxonomy
string

Type attribution for the term.

読み取り専用

コンテキスト: view, embed, edit

次のいずれか: category, post_tag, nav_menu, link_category, post_format

parent
integer

The parent term ID.

コンテキスト: view, edit

meta
object

Meta fields.

コンテキスト: view, edit

Example Request

$ curl -X OPTIONS -i http://demo.wp-api.org/wp-json/wp/v2/categories

Category一覧

引数

context

Scope under which the request is made; determines fields present in response.

初期値: view

次のいずれか: view, embed, edit

page

Current page of the collection.

初期値: 1

per_page

Maximum number of items to be returned in result set.

初期値: 10

search

Limit results to those matching a string.

exclude

Ensure result set excludes specific IDs.

初期値:

include

Limit result set to specific IDs.

初期値:

order

Order sort attribute ascending or descending.

初期値: asc

次のいずれか: asc, desc

orderby

Sort collection by term attribute.

初期値: name

次のいずれか: id, include, name, slug, include_slugs, term_group, description, count

hide_empty

Whether to hide terms not assigned to any posts.

parent

Limit result set to terms assigned to a specific parent.

post

Limit result set to terms assigned to a specific post.

slug

Limit result set to terms with one or more specific slugs.

定義

GET /wp/v2/categories

リクエスト例

$ curl http://demo.wp-api.org/wp-json/wp/v2/categories

Categoryを取得する

引数

id

Unique identifier for the term.

context

Scope under which the request is made; determines fields present in response.

初期値: view

次のいずれか: view, embed, edit

定義

GET /wp/v2/categories/<id>

リクエスト例

$ curl http://demo.wp-api.org/wp-json/wp/v2/categories/<id>

Categoryを作成

引数

description

HTML description of the term.

name

HTML title for the term.

必須: true

slug

An alphanumeric identifier for the term unique to its type.

parent

The parent term ID.

meta

Meta fields.

定義

POST /wp/v2/categories

Categoryを更新する

引数

id

Unique identifier for the term.

description

HTML description of the term.

name

HTML title for the term.

slug

An alphanumeric identifier for the term unique to its type.

parent

The parent term ID.

meta

Meta fields.

定義

POST /wp/v2/categories/<id>

リクエスト例

Categoryを削除

引数

id

Unique identifier for the term.

force

Required to be true, as terms do not support trashing.

定義

DELETE /wp/v2/categories/<id>

リクエスト例

$ curl -X DELETE http://demo.wp-api.org/wp-json/wp/v2/categories/<id>