通过_GET传递变量

I am trying to pass a variable through a GET request (which i am defining myself).

So my variable stores a url, and if someone passes d = site.com it should allow access. if not, it should fail. The only thing that is failing is passing the variable through the get

Doesnt Work:

    $redirect = site();
    $parse = parse_url($redirect);
    $next = $parse['host'];

    if ($_GET['cld'] !== $next ) redirect();

Does Work (static, not dynamic, so it doesnt get the URL)

    $redirect = site();
    $parse = parse_url($redirect);
    $next = $parse['host'];

    if ($_GET['d'] !== 'site') redirect();

Solved it myself.

Passed it through a foreach and returned the value d and then called it in my function.

    foreach($super as $d){
        if (strpos($next, $d) !== false) {
            return $d;
        }
    }

    if ($_GET['cld'] !== $d ) wp_redirect();