0
我正在使用WP REST v2编写wordpress REST API。有没有一种方法可以在我们在register_rest_route函数中定义的回调函数中处理传入的JSON参数(而不是查询参数)?自定义wordpress REST API接受JSON格式输入
例如:
function wpplugin_register_routes() {
register_rest_route('testapi/v1', 'users', array(
'methods' => 'POST',
'callback' => 'wpplugin_process_json_params',
));
}
function wpplugin_process_json_params(WP_REST_Request $request) {
// Process the $request which should be a JSON string
}