Skip to content

Instantly share code, notes, and snippets.

@zottto
Last active January 27, 2017 18:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zottto/9d89dbf92fd6e4216798 to your computer and use it in GitHub Desktop.
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...
<?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');
@media-art
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment