Skip to content

trepmal.com

  • Home
  • Plugins
  • Github
  • Me on WP.org
  • Donate

Categories

  • WordPress Bits (149)
  • Uncategorized (11)
  • Scripts (5)
  • Tidbits (5)
  • Fun (3)

Tags

  • wordpress (30)
  • administration (16)
  • plugin (9)
  • free download (8)
  • functions.php (8)

Year

  • 2018 (8)
  • 2016 (2)
  • 2015 (4)
  • 2014 (19)
  • 2013 (11)

Tag: errors

Disable Login Errors and Messages

If you want to make is it so that a user doesn’t know why a failed login failed, you can use these 2 lines of code. Useful if you’re the only user and you don’t want to give potential hackers any extra info. For example, if you have the right username but a bad password, by default it will tell you in the error message – letting the person know they have half the info correct. If a username doesn’t exist, that information is also revealed.

add_filter( 'login_errors', '__return_false' );
add_filter( 'login_messages', '__return_false' );

You might want to add a little CSS to make sure the empty error/message boxes don’t show up either:

add_action( 'login_head', 'login_head_css' );
function login_head_css() {
    ?><style type="text/css">.message, #login_error { display:none; }</style><?php
}
Posted on April 2, 2011March 1, 2012Categories WordPress BitsTags errors, login screen1 Comment on Disable Login Errors and Messages
Proudly powered by WordPress