Generates a random password drawn from the defined set of characters.
<?php wp_generate_password(); ?>
Generate a 12 character password using these characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()
<?php echo 'New password: ' . wp_generate_password(); ?>
Generate an 8 character password using only letters and numbers:
<?php echo 'New password: ' . wp_generate_password( 8, false ); ?>
Generate an 10 character password consisting of letters, numbers, special characters (!@#$%^&*()), and extra special characters (-_ []{}<>~`+=,.;:/?|):
<?php echo 'New password: ' . wp_generate_password( 10, true, true ); ?>
Since: 2.5
wp_generate_password() is located in wp-includes/pluggable.php
.