Try nonce to work
This commit is contained in:
@@ -84,13 +84,25 @@ function has_postcode()
|
|||||||
|
|
||||||
function handle_postcode_modal($data)
|
function handle_postcode_modal($data)
|
||||||
{
|
{
|
||||||
$header = $data->get_headers();
|
$headers = $data->get_headers();
|
||||||
$params = $data->get_params();
|
$params = $data->get_params();
|
||||||
$nonce = $headers["x_wp_nonce"][0];
|
$nonce = $headers["X-WP-Nonce"];
|
||||||
|
|
||||||
if (wp_verify_nonce($nonce, "wp_rest")) {
|
if (!wp_verify_nonce($nonce, "wp_rest")) {
|
||||||
echo $nonce;
|
$resp = [
|
||||||
|
"status" => "succes",
|
||||||
|
"message" => $nonce,
|
||||||
|
];
|
||||||
|
echo json_encode($resp);
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$resp = [
|
||||||
|
"status" => "error",
|
||||||
|
"message" => "nonce do",
|
||||||
|
];
|
||||||
|
echo json_encode($resp);
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function register_modal_api()
|
function register_modal_api()
|
||||||
|
|||||||
Reference in New Issue
Block a user