2015-02-08 107 views

回答

0

是的,那是可能的。正確執行以下步驟。

步驟-1:刪除用戶名文本框

​​

步驟2:刪除用戶名錯誤

//Remove error for username, only show error for email only. 
add_filter('registration_errors', function($wp_error, $sanitized_user_login, $user_email){ 
    if(isset($wp_error->errors['empty_username'])){ 
     unset($wp_error->errors['empty_username']); 
    } 

    if(isset($wp_error->errors['username_exists'])){ 
     unset($wp_error->errors['username_exists']); 
    } 
    return $wp_error; 
}, 10, 3); 

步驟3:處理背景註冊功能。

add_action('login_form_register', function(){ 
    if(isset($_POST['user_login']) && isset($_POST['user_email']) && !empty($_POST['user_email'])){ 
     $_POST['user_login'] = $_POST['user_email']; 
    } 
}); 

將上面的代碼放在您主題的functions.php文件中。