How do I fetch all comments per post via WP REST API?


I am busy trying to understand how WP REST API works in combination with React. When I check the documentation of WP REST API, it confuses me a bit.

For example here, it seems like you have to specifically give the ID of a post in the query to fetch the post. Can we not use a variable for this? If so, how could this be done? And how could we make sure that per post, automatically we also fetch its comments beneath it?

I mean, this gets all of the comments:

But it does not let me combine this with the posts. How do we relate them with each other?

Another example:

Would mean that we you fetch the categories of post with ID = 33, but how can we make this generic? Like$GET_POST_ID or so?

, , , , Siyah 3 years 2020-04-05T04:50:49-05:00 0 Answers 97 views 0

Leave an answer