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

120
121
122
123
124
125
126
127
128
129
130
131
132
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();
    }
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment