![]() It needs to be called on the rest_api_init action hook. To register routes you should use the register_rest_route() function. If we wanted to create an endpoint that would return the phrase “Hello World, this is the WordPress REST API” when it receives a GET request, we would first need to register the route for that endpoint. For the above example, the full URL would then be On sites without pretty s, the route is instead added to the URL as the rest_route parameter. DELETE triggers a delete_item method, returning the now-deleted post data to the client. ![]()
0 Comments
Leave a Reply. |