Welcome, visitor! Log in
 

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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: 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.

Source View

This hook occurs 2 times in this file.

Line Code
1321  *
1322  * @link https://api.wordpress.org/secret-key/1.1/salt/ Create secrets for wp-config.php
1323  *
1324  * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
1325  * @return string Salt value
1326  */
1327 function wp_salt( $scheme = 'auth' ) {
1328      static $cached_salts = array();
1329      if ( isset( $cached_salts[ $scheme ] ) )
1330           return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1331
1332      static $duplicated_keys;
1333      if ( null === $duplicated_keys ) {
1334           $duplicated_keys = array( 'put your unique phrase here' => true );
1335           foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
1336                foreach ( array( 'KEY', 'SALT' ) as $second ) {
1337                     if ( ! defined( "{$first}_{$second}" ) )
1338                          continue;
1339                     $value = constant( "{$first}_{$second}" );
 
Line Code
1367                if ( ! $key ) {
1368                     $key = wp_generate_password( 64, true, true );
1369                     update_site_option( 'secret_key', $key );
1370                }
1371           }
1372           $salt = hash_hmac( 'md5', $scheme, $key );
1373      }
1374
1375      $cached_salts[ $scheme ] = $key . $salt;
1376      return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1377 }
1378 endif;
1379
1380 if ( !function_exists('wp_hash') ) :
1381 /**
1382  * Get hash of given string.
1383  *
1384  * @since 2.0.3
1385  * @uses wp_salt() Get WordPress salt