I think, your PHP syntax is wrong. Try these,
function wpgenerapass_generate_password( $password, $length, $special_chars, $extra_special_chars ) {
$chars="abcdefghijklmnopqrstuvwxyz";
$chars .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$chars .= '0123456789';
$chars .= '!@#$%^&*()';
if ( $extra_special_chars ) {
$chars .= '-_ []{}<>~`+=,.;:/?|';
}
$wpgenerapass_password = ''; // Initialize the password string
$password_length = 8;
for ( $i = 0; $i < $password_length; $i += 1 ) {
$wpgenerapass_password .= substr( $chars, wp_rand( 0, strlen( $chars ) - 1 ), 1 );
}
return $wpgenerapass_password;
}
add_filter( 'random_password', 'wpgenerapass_generate_password', 99, 4 );
Related Posts:
- How to change user password with wp-cli?
- wordpress redirect after password reset
- Loosen/disable password policy
- Password Protect Custom Page
- How can I change the default wordpress password hashing system to something custom?
- If I change the salt keys in my wp-config will all passwords break?
- Conditional to test if post has password protection enabled
- Check the password of a user
- How to add Wp_error using lostpassword_post hook when validating custom field?
- Create a USERNAME and PASSWORD protected WordPress page
- Why do generated passwords start/end with spaces?
- Reseting admin password through PHPMyadmin fails
- Check Password Reset Key Not Woking
- Reset password – set minimum length for new password
- How to shorten length of auto generated password sent during registration?
- Forgot password not working
- wp_hash_password unexpected behaviour
- Password reset message – change the network_home_url( ‘/’ )
- Redirect a password protected page?
- Lost password link is redirecting to /shop/my-account/lost-password/
- Change default recovery link expiration time
- Lost password link redirects to my-account/lost-password/,how to fix it back to default lost password
- Password protect custom template
- Set content type to HTML for lost password email only
- Custom password generator for users
- Password protecting template, secured content not showing if even password is right
- How validate usernames/passwords against WP’s database?
- Make post password required to publish
- WordPress reset password returns invalid key
- Password reset bug? – “Sorry, that key does not appear to be valid”
- How to set minimum length and error message for password recovery?
- Why is resetting the WordPress Users password not working?
- How Authentication in wordpress works? wp_authenticate_username_password()
- Password Protected page not asking for a password
- Password protection for page template
- Custom login form for front-end user as well as admin
- Password changed [duplicate]
- Enable Update button only when password is shown strong
- How to get user password before being encrypted outside the wordpress core once add a new user from dashboard?
- Adding parameters to password reset key
- wp_hash_password create a different hash everytime
- Custom password form allows unlock two posts with the same password
- How to change password
- Generating the password reset link automatically
- Password protect pages – allow more than one password
- Like to store multiple passwords in db table wp_posts field post_password?
- Send password to user instead of reset password link
- Custom form for password protected page
- How to check user’s password?
- What’s the algorithm to verify user password?
- Customize retrieve password message
- How to recover password from a user
- resend user login & password with custom button
- WordPress admin creation through phpmyadmin not working
- Why does hashing a password result in different hashes, each time?
- current user’s password check
- How to initiate password reset flow by code
- Change password fields
- lostpassword_redirect filter is not used
- Password Protect or IP to access under development WordPress site otherwise shown a placeholder page
- Password-protected page redirecting to frontpage when I enter the password
- 2 accounts under same email preventing me from loging in
- How would I create a Password Protected Page with Content on it?
- wordpress custom password change problem
- Allow all reset password links within the past 24 hours to be valid and accepted
- WooCommerce Lost Password reset goes to 404
- Set id and password for each post
- I have to reset the admin password each time
- Create Member who can’t be changed
- Automatically change the page password for more than one page
- Sending Reset Password email via Web API
- I can’t recover my password
- $expiration_duration = apply_filters( ‘password_reset_expiration’, DAY_IN_SECONDS );
- Cannot get function.php code to work to remove Lost Password link on live site
- Entering a WP site with a SMS code
- Problem with login / reset password links in users emails
- Password Protect content() on homepage
- Function called by password_reset action passed only 1 argument instead of 2 in PHP 7.2.11
- Allow users from my ASP.Net MVC site to access my private WordPress site
- Lost Password redirect to My Account
- Multiple pages protected by different passwords. Possible to track multiple passwords at a time?
- How do I display the password field on the WordPress user registration screen?
- Not able to log for the first time on a salted WordPress by creating pwd on BD
- Bypass a WordPress Password Protected Post or Page via a URL
- Custom page password recovery
- Password Protected Logout Button Not Working
- Is it possible to display newly generated password after wp_generate_password()?
- Password protect wp-login.php
- How do I password protect a page of posts on WordPress?
- forgot password
- Revise my keyword but still cannot login
- WordPress not taking password and username
- mysql update user’s password and activation key
- Is it possible to have users register without having a password?
- How WordPress hashes passwords
- Reset Password – change from name and email address. It stucks at admin. Want to change it to info
- check if post is set to “password protected”
- FTP Password (not private key-value pair) for EC2 Instance
- How to Disable Pre-population of Password on Password Reset
- My WordPress password for admin account is changing automatically