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 |
---|---|
1331 | * |
1332 | * @param string $nonce Nonce that was used in the form to verify |
1333 | * @param string|int $action Should give context to what is taking place and be the same when nonce was created. |
1334 | * @return bool Whether the nonce check passed or failed. |
1335 | */ |
1336 | function wp_verify_nonce($nonce, $action = -1) { |
1337 | $user = wp_get_current_user(); |
1338 | $uid = (int) $user->ID; |
1339 | if ( ! $uid ) |
1340 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
1341 |
|
1342 | $i = wp_nonce_tick(); |
1343 |
|
1344 | // Nonce generated 0-12 hours ago |
1345 | if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) === $nonce ) |
1346 | return 1; |
1347 | // Nonce generated 12-24 hours ago |
1348 | if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) === $nonce ) |
1349 | return 2; |
Line | Code |
1359 | * @since 2.0.3 |
1360 | * |
1361 | * @param string|int $action Scalar value to add context to the nonce. |
1362 | * @return string The one use form token |
1363 | */ |
1364 | function wp_create_nonce($action = -1) { |
1365 | $user = wp_get_current_user(); |
1366 | $uid = (int) $user->ID; |
1367 | if ( ! $uid ) |
1368 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
1369 |
|
1370 | $i = wp_nonce_tick(); |
1371 |
|
1372 | return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10); |
1373 | } |
1374 | endif; |
1375 |
|
1376 | if ( !function_exists('wp_salt') ) : |
1377 | /** |