Created
March 11, 2019 16:34
-
-
Save unnamedfeeling/ae96a52ea4c70174c8fb55f94ad3cc7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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