WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 1249 | * |
| 1250 | * @param string $nonce Nonce that was used in the form to verify |
| 1251 | * @param string|int $action Should give context to what is taking place and be the same when nonce was created. |
| 1252 | * @return bool Whether the nonce check passed or failed. |
| 1253 | */ |
| 1254 | function wp_verify_nonce($nonce, $action = -1) { |
| 1255 | $user = wp_get_current_user(); |
| 1256 | $uid = (int) $user->ID; |
| 1257 | if ( ! $uid ) |
| 1258 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
| 1259 | |
| 1260 | $i = wp_nonce_tick(); |
| 1261 | |
| 1262 | // Nonce generated 0-12 hours ago |
| 1263 | if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) === $nonce ) |
| 1264 | return 1; |
| 1265 | // Nonce generated 12-24 hours ago |
| 1266 | if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) === $nonce ) |
| 1267 | return 2; |
| Line | Code |
| 1277 | * @since 2.0.3 |
| 1278 | * |
| 1279 | * @param string|int $action Scalar value to add context to the nonce. |
| 1280 | * @return string The one use form token |
| 1281 | */ |
| 1282 | function wp_create_nonce($action = -1) { |
| 1283 | $user = wp_get_current_user(); |
| 1284 | $uid = (int) $user->ID; |
| 1285 | if ( ! $uid ) |
| 1286 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
| 1287 | |
| 1288 | $i = wp_nonce_tick(); |
| 1289 | |
| 1290 | return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10); |
| 1291 | } |
| 1292 | endif; |
| 1293 | |
| 1294 | if ( !function_exists('wp_salt') ) : |
| 1295 | /** |