Last active
January 27, 2017 18:17
-
-
Save zottto/9d89dbf92fd6e4216798 to your computer and use it in GitHub Desktop.
Ein Snippet, um die Login-Meldungen von WordPress zu vereinheitlichen. In einem Custom Plugin benutzen...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wp_modify_login_error_incorrect_password($user) { | |
if ( is_wp_error( $user ) ) { | |
$error_string = $user->get_error_message(); | |
if ($user->get_error_code() == 'incorrect_password') { | |
$user = new WP_Error('invalid_username', $error_string); | |
} | |
} | |
return $user; | |
} | |
add_filter('authenticate', 'wp_modify_login_error_incorrect_password', 25, 1); | |
function error_message_failed_login() { | |
return 'Fehlerhafter Loginversuch!'; | |
} | |
add_filter('login_errors', 'error_message_failed_login'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi... Danke für das Snippet. Könnte ich es auch direkt in die function.php einfügen? Oder ist ein Custom Plugin sinnvoller?
Danke für einen Tipp Tom