V
V
VANY2017-07-05 14:51:35
JSON
VANY, 2017-07-05 14:51:35

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

2 answer(s)
Y
Yunus Gaziev, 2017-07-05
@vanyproduction

$_GET['id']and Learning to work with GET and POST requests

I
Igor Vorotnev, 2017-07-07
@HeadOnFire

Yet it is described in detail in the handbook - REST API Parameters .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question