---
title: How to Modify Blocked Hosts List
canonical: https://wpsecurityninja.com/docs/filters-hooks/filter-blocked_hosts_items/
---
The `blocked_hosts_items` filter lets you add hostname fragments that Filter Suspicious Queries can match during **hostname reverse-DNS checks**.

**Important:** Hostname matching is **off by default**. URI, query string, user agent, and referrer rules still run without it. To use this filter, first enable hostname checks with [`secnin_cf_check_blocked_hosts`](https://wpsecurityninja.com/docs/filters-hooks/secnin_cf_check_blocked_hosts/).

User-facing guide: [Filter Suspicious Queries](https://wpsecurityninja.com/docs/firewall/filter-suspicious-queries/).

## Add a blocked hostname fragment

```php
add_filter( 'blocked_hosts_items', 'filter_blocked_hosts_items' );

function filter_blocked_hosts_items( $hosts ) {
    $hosts[] = 'examplehost';
    return $hosts;
}
```

The filter looks for that string in the resolved hostname. Be as specific or broad as you need.

> Not sure how to add this code? See [Add custom code to your website](https://wpsecurityninja.com/docs/installation-and-usage/custom-code-website/).

## Related

* [Customizing firewall filter rules](https://wpsecurityninja.com/docs/filters-hooks/customizing-firewall-filter-rules/)
* [Filter secnin_cf_check_blocked_hosts](https://wpsecurityninja.com/docs/filters-hooks/secnin_cf_check_blocked_hosts/)
