Ajax::verify_nonce()
Description #
Verify nonce and die if failed.
Nonce key is stored in $nonce_key property. To bypass verification simply set $nonce_key to an empty value.
Source #
File: classes/ajax.php
private function verify_nonce() {
if ( empty( $this->nonce_key ) ) {
return;
}
$nonce = ap_sanitize_unslash( '__nonce', 'r' );
// Verify nonce.
if ( ! wp_verify_nonce( $nonce, $this->nonce_key ) ) {
$this->snackbar( __( 'Trying to cheat?!', 'anspress-question-answer' ) );
$this->send();
}
}
Expand full source code Collapse full source code View on GitHub: classes/ajax.php:120
Add your comment