Filter – blocked_hosts_items

This filter allows you to modify the list of blocked hosts the plugin monitors and restricts.

You can seamlessly integrate new hosts to be blocked with a straightforward piece of code.

To incorporate a new host you wish to block, you should utilize the following code. It’s a straightforward script that acquires the current list of blocked hosts, appends any additional hosts we aim to block, and then reinstates it for the plugin’s use.

The filter scans for any instance of the specified terms, allowing you to be as precise or broad in your specifications as needed.

add_filter( 'blocked_hosts_items', 'filter_blocked_hosts_items' );

function filter_blocked_hosts_items( $hosts ) {
  // To add more than one, replicate the line below with the desired modifications.
  $hosts[] = 'examplehost';
  return $hosts;
}

Was this helpful?