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)

Action Hook: login_head

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

Change the Login Screen Image

Normally, when you visit the login screen, there’s a nice WordPress image. If you want to change that to something else, this is how:

add_action('login_head', 'change_login_image');
function change_login_image() {
	$name = urlencode(get_option('blogname'));
	?><style type="text/css"> h1 a { background-image: url('http://dummyimage.com/310x70/f9/000&text=++<?php echo $name; ?>+'); } </style><?php
}
Posted on February 27, 2011March 1, 2012Categories WordPress BitsTags log inLeave a comment on Change the Login Screen Image
Proudly powered by WordPress