• Resolved Jake Ward

    (@jakeward)


    Hi,

    Does anyone have any experience in blocking searches from certain IPs from appearing in reports?

    I currently, have the below but searches are still coming through?

    add_filter(‘relevanssi_ok_to_log’, ‘rlv_block_vuln’, 10, 5);
    function rlv_block_vuln($ok, $query, $hits, $user_agent, $ip)
    {
    if (‘ip.address.here’ === substr($ip, 0, 6)) {
    $ok = false;
    }
    return $ok;
    }

    Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    That seems correct to me. Have you tried debugging this code? Does the function run? Does the substr() get the expected value? Is the boolean set correctly? A little bit of debugging should tell you where the function fails.

    Thread Starter Jake Ward

    (@jakeward)

    Thanks @msaari for you response (and such a quick one)! I’ve debugged the code and can confirm that the IP wasn’t being passed through to the function. Have now fixed that so that it is and can confirm that it is working. Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Block Searches From Certain IP From Reports’ is closed to new replies.