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 |
---|---|
1246 | * |
1247 | * @param string $nonce Nonce that was used in the form to verify |
1248 | * @param string|int $action Should give context to what is taking place and be the same when nonce was created. |
1249 | * @return bool Whether the nonce check passed or failed. |
1250 | */ |
1251 | function wp_verify_nonce($nonce, $action = -1) { |
1252 | $user = wp_get_current_user(); |
1253 | $uid = (int) $user->ID; |
1254 | if ( ! $uid ) |
1255 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
1256 |
|
1257 | $i = wp_nonce_tick(); |
1258 |
|
1259 | // Nonce generated 0-12 hours ago |
1260 | if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) == $nonce ) |
1261 | return 1; |
1262 | // Nonce generated 12-24 hours ago |
1263 | if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) == $nonce ) |
1264 | return 2; |
Line | Code |
1274 | * @since 2.0.3 |
1275 | * |
1276 | * @param string|int $action Scalar value to add context to the nonce. |
1277 | * @return string The one use form token |
1278 | */ |
1279 | function wp_create_nonce($action = -1) { |
1280 | $user = wp_get_current_user(); |
1281 | $uid = (int) $user->ID; |
1282 | if ( ! $uid ) |
1283 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
1284 |
|
1285 | $i = wp_nonce_tick(); |
1286 |
|
1287 | return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10); |
1288 | } |
1289 | endif; |
1290 |
|
1291 | if ( !function_exists('wp_salt') ) : |
1292 | /** |