它是right here in the codex.
这是示例代码,显示了如何创建新用户:
$user_id = username_exists( $user_name );
if ( !$user_id and email_exists($user_email) == false ) {
$random_password = wp_generate_password( $length=12, $include_standard_special_chars=false );
$user_id = wp_create_user( $user_name, $random_password, $user_email );
} else {
$random_password = __(\'User already exists. Password inherited.\');
}
在这里,
another wrapper version with more functionality.
$website = "http://example.com";
$userdata = array(
\'user_login\' => \'login_name\',
\'user_url\' => $website,
\'user_pass\' => NULL // When creating an user, `user_pass` is expected.
);
$user_id = wp_insert_user( $userdata ) ;
//On success
if ( ! is_wp_error( $user_id ) ) {
echo "User created : ". $user_id;
}
关于构造表单、与mailchip集成等的部分-如果您需要查看代码示例以涵盖问题的这一部分,最好在不同的问题中提问。