2013-04-14 47 views

回答

3

這個在wp-login.php有一個這樣的過濾器。但不要觸摸WordPress核心文件,篩選器和動作鉤子已到位,以便您可以在不編輯核心的情況下修改WP行爲。

add_filter('registration_errors', 'registration_errors_so_16002591'); 

function registration_errors_so_16002591($errors) 
{ 
    if(isset($errors->errors['invalid_email'])) { 
     $errors->errors['invalid_email'][0] = '<strong>bad</strong> email'; 
    } 
    if(isset($errors->errors['username_exists'])) { 
     $errors->errors['username_exists'][0] = 'nick <strong>picken</strong>'; 
    } 
    // Other errors 
    // ['empty_email'] 
    // ['empty_username'] 

    return $errors; 
} 

相關Q &答:Where to put my code: plugin or functions.php?