WordPress’s Disallowed Comment Keys can filter comments associated with an IP address. This guide explains how to add that address to the comment filter.
This procedure does not block the address from viewing your website or logging in. It filters comments only. Website-wide restrictions need an appropriate server, firewall or application access control.
Add a disallowed comment key
-
Open Settings > Discussion in WordPress.

-
Find Disallowed Comment Keys.

-
Add the address on its own line, preserving existing entries, then select Save Changes.

These keys are also matched against comment fields such as content and author details. Check each entry to avoid unintentionally filtering legitimate comments.
Check the filter
Test as a normal visitor rather than an administrator or the post’s author. Matching comments normally go to Trash, or Spam depending on configuration; plugins can modify the outcome. Check those folders rather than expecting a specific error message.
Remove the exact key and save if the filter is no longer needed. Shared or reassigned IP addresses may affect other commenters.