Get post categories with WordPress JSON API (WP-API plugin)

Hoping this is an easy/fast one. I am using WP-API and I’d like to get the categories that a given post belongs to (I’d also like to get the tags).

From the docs the only way I can see to do this is to request the contents of each category and check whether or not the post_id is in one of them. Same story for tags since it also uses the taxonomy structure.

Read More

How can I ask a GET /posts/:post_id request to return categories and tags?

Related posts

Leave a Reply

1 comment

  1. GET /posts returns an array of posts, and each post has a “terms” child with a “category” array as its child.

    Same goes for GET /posts/:id

    If you assign tags to a post, my understanding is that it should return the tags inside the “terms” as well.