Skip to content

Instantly share code, notes, and snippets.

@anka
Created April 7, 2023 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anka/99298f8e78ec6b952bc30870cac6053d to your computer and use it in GitHub Desktop.
Save anka/99298f8e78ec6b952bc30870cac6053d to your computer and use it in GitHub Desktop.
Example implementation of a Wordpress function to process a POST request
function process_data_submission(WP_REST_Request $request) {
$data = json_decode($request->get_body(), true);
// Perform your data processing here
$response = new WP_REST_Response(array('status' => 'success', 'message' => 'Data processed successfully'));
$response->set_status(200);
return $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment