Processing requests (and responses)
WP_REST_Request class will receive as an object the callback function of each endpoint, which will then further be passed as an object. To receive the parameters from the request, which are mapped from any transport method provided, we will be using the efficient method of
get_params() to get all the data from the validated and sanitized request, with all of the correspondent defaults filled in. Instead of using the method of accessing the global GET or POST variables, we will be using the method described previously, and the reasons for that are the following:
- The array that is returned is validated and sanitized and will handle the switches between the transport method. Even if we choose to switch the endpoints ...