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