Answer the question
In order to leave comments, you need to log in
How to pass value for wordpress in json request?
Hello, there is a code that responds to a json request with a random set of posts [wp-json/test].
How can I pass some data in the request and then use it to refine the selection of posts in the json response?
For example, I want to get posts from a category with ID=10 [wp-json/test?id=10]. How to take the id variable from the request in the php code to use it for getposts?
*sorry if there is a stupid wording in the question, I'm trying to find info on the net, but it doesn't work
Answer the question
In order to leave comments, you need to log in
$_GET['id']
and Learning to work with GET and POST requests
Yet it is described in detail in the handbook - REST API Parameters .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question