How to prevent unnecessary information from being displayed in WordPress?


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 | On Tuesday, July 13th, 2010 | Under How To's, Security | 3 Comments »


DO YOU NEED OUR HELP?

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
  • unnecessary information is displayed on failed login attempts
  • how to hide unnecessary comments wordpress
  • wordpress 3.2 add_filter login_errors
  • WordPress displays unnecessary error messages on failed log-ins.
  • wordpress displays unnecessary error messages on failed
  • how to prevent from unnecessary information collection
  • "WordPress displays unnecessary error messages on failed log-ins"
  • how to prevent information
  • message with unnecessary information
  • There’s even an easier way – install and activate Block Bad Queries (BBQ) WordPress plugin.

  • Paste it where? Beginning, end, middle? Doesn’t matter?

    • Anywhere in functions.php file – better at the end, just before ?>

Previous post:

Next post: