对于我的注册,我使用自定义注册表。它工作得很好。它发送带有用户名和密码的电子邮件。
我想生成url,这样当用户单击它时,它会自动完成激活。我不希望他们手动写入用户名或密码。我发送电子邮件的代码
$random_password = wp_generate_password( 12, false );
$status = wp_create_user( $username, $random_password, $email );
if ( is_wp_error($status) )
echo "Username already exists. Please try another one.";
else {
$from = get_option(\'admin_email\');
$headers = \'From: \'.$from . "\\r\\n";
$subject = "Registration successful";
$msg = "Registration successful.\\nYour login details\\nUsername: $username\\nPassword: $random_password";
wp_mail( $email, $subject, $msg, $headers );
echo "Please check your email for login details.";
}