Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save unnamedfeeling/ae96a52ea4c70174c8fb55f94ad3cc7f to your computer and use it in GitHub Desktop.
Save unnamedfeeling/ae96a52ea4c70174c8fb55f94ad3cc7f to your computer and use it in GitHub Desktop.
<?php
add_action( 'rest_api_init', function () {
register_rest_route( 'heartweb/v1', '/webinarData', [
'methods' => 'POST',
'callback' => 'heartweb_webinarData',
] );
} );
function heartweb_webinarData(WP_REST_Request $request){
$payload = $request->get_params();
/*
Now $payload contains array with request data from $request - no matter what type of request is handled
Read more:
https://wp-kama.ru/function/register_rest_route
https://wp-kama.ru/function/wp_send_json
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment