wp_generate_password ( $length = 12, $special_chars = true, $extra_special_chars = false )

  • (int) length Optional. The length of password to generate. Default 12.
  • (bool) special_chars Optional. Whether to include standard special characters. Default true.
  • (bool) extra_special_chars Optional. Whether to include other special characters. Used when generating secret keys and salts. Default false.
  • (string) The random password.
Defined at:


Generates a random password drawn from the defined set of characters.Uses wp_rand() to create passwords with far less predictability than similar native PHP functions like `rand()` or `mt_rand()`.

Related Functions

wp_ajax_generate_password, wp_set_password, generate_random_password, wp_ajax_nopriv_generate_password, wp_generator

Top Google Results

User discussions

wpseek mobile