From ec5186f8118042e311f22fa8611a235edb9a76ee Mon Sep 17 00:00:00 2001 From: Remo Zaros Date: Thu, 7 May 2026 17:06:48 +0200 Subject: [PATCH] Try nonce to work --- session_dialog.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/session_dialog.php b/session_dialog.php index 7bba529..06e362a 100644 --- a/session_dialog.php +++ b/session_dialog.php @@ -84,13 +84,25 @@ function has_postcode() function handle_postcode_modal($data) { - $header = $data->get_headers(); + $headers = $data->get_headers(); $params = $data->get_params(); - $nonce = $headers["x_wp_nonce"][0]; + $nonce = $headers["X-WP-Nonce"]; - if (wp_verify_nonce($nonce, "wp_rest")) { - echo $nonce; + if (!wp_verify_nonce($nonce, "wp_rest")) { + $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()