PHP code example of alexlg89 / wpnonce
1. Go to this page and download the library: Download alexlg89/wpnonce library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alexlg89 / wpnonce example snippets
$url = 'http://mysite.com/custommers';
$action = 'add-customer';
$name = '_myNonce';
$nonceUrl = WpNonce::url($url, $action, $name);
$nonceUrl = WpNonce::url($url, $action);
$action = 'add-customer';
WpNonce::field($action);
$referer = 'http://mysite.com/dashboard';
WpNonce::field($action, $referer);
WpNonce::field($action, $referer, false);
$html = WpNonce::field($action, $referer, true, false);
$action = 'add-customer';
$nonce = WpNonce::create($action);
$action = 'add-customer';
$name = '_myNonce';
$retval = WpNonce::checkAdminReferer($action, $name);
$retval = WpNonce::checkAdminReferer($action);
$action = 'add-customer';
$queryArg = '_myNonce';
$retval = WpNonce::check_ajax_referer($action, $queryArg);
$retval = WpNonce::check_ajax_referer($action, $queryArg, false);
$nonce = 'an2bf72h';
$action = 'add-customer';
$retval = WpNonce::verify($nonce, $action);
const DEFAULT_NONCE = '_wpnonce';