Disabling WordPress login hints for better security

Learn how to disable login errors and display generic messages to users in WordPress. This article shows how to disable the login errors with a simple code snippet on the theme files.

Hiding details of error messages on the login page enhances the security and user confidence for WordPress sites. This article shows how to disable login errors and display a custom message.

Editing theme file to disable login error hints and display custom error message.

🚧

Important

Always perform a backup before you make any changes to the theme files. If you break any codes, it will be easier for you to revert your site to its last good known state. Alternatively, you could also create a child theme. Read this link on how to create a child theme: https://www.hosting.com/blog/wordpress-child-theme/

To disable the login error hint and replace it with a custom message, follow these steps:

  1. Log in to your WordPress site with an administrator account.

  2. On the Dashboard in the left sidebar, click Appearance, and then click Editor:

  3. On the editor page, look at the right column where you see the "Theme Files".Under theme files, you will see a list of all the files related to your theme. In this example, we are using "Twenty Sixteen" theme.Find the file "functions.php"

  4. Copy and add the code to the end of the functions.php file. The customised login hint" You are not allowed on this website" will be displayed on the panel

function wp_remove_login_hint()
{ return 'You are not allowed on this website'; } 
add_filter( 'login_errors', 'wp_remove_login_hint' );
```![](https://static.hosting.com/kb/kb-wp-loginhints-2.png)

## Related Articles

- [Adding a custom logo to WordPress](https://kb.hosting.com/docs/adding-a-custom-logo-to-wordpress) 

- [Adding external RSS feeds to your WordPress site](https://kb.hosting.com/docs/adding-external-rss-feeds-to-your-wordpress-site) 

- [Changing a WordPress account username](https://kb.hosting.com/docs/changing-a-wordpress-account-username)