Skip to content

Instantly share code, notes, and snippets.

@murshed
Created October 24, 2019 11:32
Show Gist options
  • Save murshed/1a9c6e7b22786d0a54ba31b9e97455af to your computer and use it in GitHub Desktop.
Save murshed/1a9c6e7b22786d0a54ba31b9e97455af to your computer and use it in GitHub Desktop.
Add this code to theme function.php
<?php
add_action( 'wp_login_failed', 'themeum_login_fail' );
function themeum_login_fail( $username ) {
$referrer = $_SERVER['HTTP_REFERER'];
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
wp_redirect( $referrer . '?login=failed' );
exit;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment