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 |
---|---|
1286 | * |
1287 | * @param string $nonce Nonce that was used in the form to verify |
1288 | * @param string|int $action Should give context to what is taking place and be the same when nonce was created. |
1289 | * @return bool Whether the nonce check passed or failed. |
1290 | */ |
1291 | function wp_verify_nonce($nonce, $action = -1) { |
1292 | $user = wp_get_current_user(); |
1293 | $uid = (int) $user->ID; |
1294 | if ( ! $uid ) |
1295 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
1296 |
|
1297 | $i = wp_nonce_tick(); |
1298 |
|
1299 | // Nonce generated 0-12 hours ago |
1300 | if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) === $nonce ) |
1301 | return 1; |
1302 | // Nonce generated 12-24 hours ago |
1303 | if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) === $nonce ) |
1304 | return 2; |
Line | Code |
1314 | * @since 2.0.3 |
1315 | * |
1316 | * @param string|int $action Scalar value to add context to the nonce. |
1317 | * @return string The one use form token |
1318 | */ |
1319 | function wp_create_nonce($action = -1) { |
1320 | $user = wp_get_current_user(); |
1321 | $uid = (int) $user->ID; |
1322 | if ( ! $uid ) |
1323 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
1324 |
|
1325 | $i = wp_nonce_tick(); |
1326 |
|
1327 | return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10); |
1328 | } |
1329 | endif; |
1330 |
|
1331 | if ( !function_exists('wp_salt') ) : |
1332 | /** |