is there any solution to get the category name instead of id in the response on following endpoint? /wp-json/wp/v2/posts/:post_id
Thanks Guys
By adding the _embed
query parameter to the endpoint, you can also retrieve categories.
It will be populated under _embeded
object and then you can access it under wp:term
in the JSON response.
Here's an example of how to do it for posts
:
{{site}}/wp-json/wp/v2/posts?_embed=
Notice that _embed
can get different values. For example, if you only need to embed wp:term
(includes categories and tags) in the final result you can do this:
{{site}}/wp-json/wp/v2/posts?_embed=wp:term
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With