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
1405  *
1406  * @link https://api.wordpress.org/secret-key/1.1/salt/ Create secrets for wp-config.php
1407  *
1408  * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
1409  * @return string Salt value
1410  */
1411 function wp_salt( $scheme = 'auth' ) {
1412      static $cached_salts = array();
1413      if ( isset( $cached_salts[ $scheme ] ) )
1414           return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1415
1416      static $duplicated_keys;
1417      if ( null === $duplicated_keys ) {
1418           $duplicated_keys = array( 'put your unique phrase here' => true );
1419           foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
1420                foreach ( array( 'KEY', 'SALT' ) as $second ) {
1421                     if ( ! defined( "{$first}_{$second}" ) )
1422                          continue;
1423                     $value = constant( "{$first}_{$second}" );
 
Line Code
1451                if ( ! $key ) {
1452                     $key = wp_generate_password( 64, true, true );
1453                     update_site_option( 'secret_key', $key );
1454                }
1455           }
1456           $salt = hash_hmac( 'md5', $scheme, $key );
1457      }
1458
1459      $cached_salts[ $scheme ] = $key . $salt;
1460      return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1461 }
1462 endif;
1463
1464 if ( !function_exists('wp_hash') ) :
1465 /**
1466  * Get hash of given string.
1467  *
1468  * @since 2.0.3
1469  * @uses wp_salt() Get WordPress salt