Skip to content

Commit a6e415a

Browse files
committed
Add nonce to AjaxButton enqueue
A nonce has been added to the AjaxButton enqueue to enhance security. This nonce ('rwps-ajax-button-nonce') is localized to 'rwps_ajax_button' using the addLocalize function.
1 parent 87db3a8 commit a6e415a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/Fields/AjaxButton.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function __construct(string $id)
3636
}
3737

3838
$enqueue = new EnqueueScript('rwps-ajax-button', $src, PluginVersion::get(), ['jquery']);
39+
$enqueue->addLocalize('rwps_ajax_button', ['nonce' => wp_create_nonce('rwps-ajax-button-nonce')]);
3940

4041
$this->addEnqueue($enqueue);
4142
}

0 commit comments

Comments
 (0)