从DB1(非wp数据库)获取所有数据并保存到$array.在您的functions.php 用于将用户插入DB2(wordpress数据库)
function cxg_wp_insert_user() {
foreach ( $array as $arr ) {
$user_data = array(
\'ID\' => \'\',
\'user_pass\' => wp_generate_password(),
\'user_login\' => $loginName,
\'user_nicename\' => $nicename,
\'user_url\' => \'\',
\'user_email\' => $eMail,
\'display_name\' => $displayName,
\'nickname\' => \'$nickname,
\'first_name\' => $firstName,
\'role\' => get_option(\'default_role\')
}
);
$user_id = wp_insert_user( $user_data );
}
add_action( \'admin_init\', \'cxg_wp_insert_user\' );
3. After updating disable this function
注意:有关插入用户转到的更多详细信息
wordpress insert user codex