Skip to content

Instantly share code, notes, and snippets.

@tradesouthwest
Created January 6, 2019 02:07
Show Gist options
  • Save tradesouthwest/6563a578daa6585899e2591e0c7a8557 to your computer and use it in GitHub Desktop.
Save tradesouthwest/6563a578daa6585899e2591e0c7a8557 to your computer and use it in GitHub Desktop.
use snippet to test for ajax or admin referer nonce
function tradesouthwest_nonce_test()
{
do_action( 'check_admin_referer', $action, $result);
if( !$result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) {
wp_nonce_ays( $action );
die();
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment