If you’re experiencing security issues with your WordPress site, or you find certain users are abusing the resources you’ve created and/or other users, you may wish to ban that user from accessing your site. One of the simplest ways to ban a user is to block their IP address.
When a user visits or leaves a comment on your site, their IP address is registered in your database, allowing you to trace suspicious or abusive behaviour. To view captured IP addresses, select Comments from the WordPress admin sidebar and you’ll see an IP address listed under each user name (for example: 184.108.40.206).
Alternatively, you can review your server logs to identify users that have accessed your site but have not left a comment. To do so, log into the HostPapa dashboard and select My cPanel. Navigate to Metrics > Raw Access to view the server logs.
Select your WordPress site’s domain and the server log will be downloaded as a compressed archive (gzip) file. To extract the file contents, use an application such as 7-zip (https://www.7-zip.org/download.html). Once extracted, you can open the access log file in TextEdit (Mac OS) or Notepad (Windows).
You’ll see an IP address registered against each entry in the access log.
When you’ve identified the user’s IP address, you can proceed to block access to your site. There are a number of methods you can employ to block access, including the use of .htaccess rules, but WordPress also includes an integrated comment blacklist feature that is simpler to use. Head to Settings > Discussion and enter the IP addresses you wish to block in the Comment Blacklist box. This will prevent users at that IP address from commenting on posts and pages.
If you wish to block access fully, you can do so from My cPanel.
Select Security > IP Blocker and, under Add an IP or Range, enter the IP address(es) you wish to block from your site. Click the Add button and the block will be imposed immediately.
If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.