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