2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WordPress REST APIでカテゴリーを指定する

Last updated at Posted at 2021-10-10

WordPress REST APIでカテゴリーを指定したURLの書き方。

ページ指定や投稿ID指定、取得件数指定はよく解説記事があるが、カテゴリー指定の記事は殆どなかった。

1つのカテゴリーを指定

https://example.com/wp-json/wp/v2/posts?categories=1

categories=の後にカテゴリーIDの数字を入力する

複数のカテゴリーを指定

https://example.com/wp-json/wp/v2/posts?categories=1+3+5

categories=の後に+を挟んでカテゴリーIDの数字を好きなだけ入力する

参考

その他のWordPress REST APIの細かいカスタマイズ方法については以下の記事が参考になります。

WordPressのお役立ち情報

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?