Skip to navigation

Dipak Gajjar Dipak C. Gajjar

Entrepreneur • Full Stack WordPress Developer

  • Home
  • Return to Content

Header Menu

  • Home
  • About
  • Services
  • Blog
  • Shop
  • Contact
  •  

Tag Archives: failed login attempts

Last updated on August 23rd, 2020

Redirect failed login attempts to any location in WordPress

Adding the following code snippet into the functions.php of your wordpress theme will allow you to redirect failed login attempts to any location.

/* Adding this snippet to the functions.php or your wordpress theme will allow you to redirect failed login attempts to any location. */
add_action( 'wp_login_failed', 'dcg_redirect_failed_login' );
function dcg_redirect_failed_login( $username ) {
$referrer = $_SERVER['HTTP_REFERER'];
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
wp_redirect( $referrer . '?login=failed' );
exit;
}
}

view raw
functions.php
hosted with ❤ by GitHub

  • Code Snippet, Tricks, Tweaks & How tos, WordPress
  • 2 Comments
  • failed login attempts, redirect

Tools

- Paypal's Payment Link Generator

Article Categories:

  • Code Snippet (12)
  • Easy Digital Downloads (1)
  • Linux (2)
  • Mac (4)
  • News (5)
  • PHP MySQL (4)
  • Plugins (5)
  • Tricks, Tweaks & How tos (20)
  • Windows (2)
  • WordPress (17)

Recommendations

SiteGround WordPress Hosting
* I only recommend the products that I use personally or for my clients.
About
⋆ About
⋆ Services
⋆ Blog
⋆ WordPress Speed Optimization
⋆ WordPress Support & Maintenance
Popular Plugins
⋆ WP Performance Score Booster
⋆ WP Super Minify
⋆ WP Open Comment Links in
New Window

⋆ DCG Display Plugin Data
⋆ Easy Digital Downloads – Extra
note(s) On Checkout
Additional Info.
⋆ Support
⋆ Privacy Policy
⋆ Terms & Conditions
⋆ Contact us
© 2021, Dipak C. Gajjar
Powered by WordPress