Skip to content

Instantly share code, notes, and snippets.

@Pirenko
Created July 16, 2019 10:20
Show Gist options
  • Select an option

  • Save Pirenko/6864e94623d2f30e3086c069c5c73ab1 to your computer and use it in GitHub Desktop.

Select an option

Save Pirenko/6864e94623d2f30e3086c069c5c73ab1 to your computer and use it in GitHub Desktop.
// Generate a password
$user_pass=randomPassword();
// Add user
$new_user=wp_create_user( "[email protected]", $user_pass , "[email protected]");
//Add secret key field
$secret_string=wp_generate_password( 8, false );
update_user_meta( $new_user, 'secret_key', $secret_string );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment