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();
		}
	}

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