type="text/css" />

How to prevent unnecessary information from being displayed in WordPress?

When you fail to log into a WordPress blog, the CMS displays some info telling you what went wrong. This is good if you’ve forgotten your password, but it might also be good for people who want to hack your blog. So, why not prevent WordPress from displaying error messages on failed log-ins?

To remove log-in error messages, simply open your theme’s functions.php file, and paste the following code:

add_filter( 'login_errors', create_function('$a', "return null;") );

Save the file, and see for yourself: no more messages are displayed if you fail to log in. Please note that there are several functions.php files. Be sure to change the one in your wp-content directory.

With this code, we’ve added a simple hook to overwrite the login_errors () function. Because the custom function that we created returns only null, the message displayed will be a blank string.

By Jinnat Ul Hasan | On Tuesday, July 13th, 2010 | Under How To's, Security | 3 Comments »


Contact our experts, most of the time we assist our readers free of charge.

Those who found this page were searching for:

  • prevent php file from being displayed
  • checkout hide unnecessary information
  • unnecessary information is displayed on failed login attempts
  • wordpress WordPress displays unnecessary error messages on failed log-ins.
  • wordpress 3.2 add_filter login_errors
  • php hide uncecessory error
  • Removing unnecessary error messages on failed log-ins.wordpress
  • WordPress displays unnecessary error messages on failed log-ins
  • login_errors hook
  • WordPress displays unnecessary error messages on failed log-ins

Previous post:

Next post: