How to disable WordPress login hints for better security

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.

Always perform a backup before you make any changes to the theme files. It will be easier for you to revert your site to its last good known state if you break any codes. Alternatively you could also create a child theme. Read this link on how to create a child theme: https://www.a2hosting.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' );

     


 

Get WordPress Hosting

Article Details

  • Level: Beginner

Other Articles in This Category

Show More

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

 

 

Loading