WPDev.one
Core Function
View Source on Trac ↗

check_ajax_referer()

check_ajax_referer( mixed $action = -1, mixed $query_arg = false, mixed $stop = true )

Verifies the Ajax request to prevent processing requests external of the blog.

Parameters 3 required

Name / Type Description
(int

| string) $action Action nonce.

Required
mixed

(false | string) $query_arg Optional. Key to check for the nonce in `$_REQUEST` (since 2.5). If false, `$_REQUEST` values will be evaluated for '_ajax_nonce', and '_wpnonce' (in that order). Default false.

Required
bool

$stop Optional. Whether to stop early when the nonce cannot be verified. Default true.

Required

Return Value

((int)
(int | false) 1 if the nonce is valid and generated between 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago. False if the nonce is invalid.

Function Information

Since Version
2.0.3
Source File
wp-includes/pluggable.php
Advertisement