Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: salt

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
1360  *
1361  * @link https://api.wordpress.org/secret-key/1.1/salt/ Create secrets for wp-config.php
1362  *
1363  * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
1364  * @return string Salt value
1365  */
1366 function wp_salt( $scheme = 'auth' ) {
1367      static $cached_salts = array();
1368      if ( isset( $cached_salts[ $scheme ] ) )
1369           return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1370
1371      static $duplicated_keys;
1372      if ( null === $duplicated_keys ) {
1373           $duplicated_keys = array( 'put your unique phrase here' => true );
1374           foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
1375                foreach ( array( 'KEY', 'SALT' ) as $second ) {
1376                     if ( ! defined( "{$first}_{$second}" ) )
1377                          continue;
1378                     $value = constant( "{$first}_{$second}" );
 
Line Code
1406                if ( ! $key ) {
1407                     $key = wp_generate_password( 64, true, true );
1408                     update_site_option( 'secret_key', $key );
1409                }
1410           }
1411           $salt = hash_hmac( 'md5', $scheme, $key );
1412      }
1413
1414      $cached_salts[ $scheme ] = $key . $salt;
1415      return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1416 }
1417 endif;
1418
1419 if ( !function_exists('wp_hash') ) :
1420 /**
1421  * Get hash of given string.
1422  *
1423  * @since 2.0.3
1424  * @uses wp_salt() Get WordPress salt