• I tried to create a plugin to get the referrer URL, but it always return nothing (rewrite rules probably caused it). I basically used this:

    add_filter('init','recordhit');
    function recordhit($not_used='') {
        $referer = "Referer: ".(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'Unknown' );
    }

    And tried to echo out $referer, which didn’t work. When I used:

    add_filter('init','recordhit');
    function recordhit($not_used='') {
        $referer = "Referer: ".(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'Unknown' );
    echo $referer;
    }

    it still failed.

    Oh and I’m aware that there’s a plugin for something like this, but I don’t want to use it as I have plans to do something else.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Tried your code on my test setup and see no problems. And it’s unlikely to be a rewrite issue.

    Oh and I’m aware that there’s a plugin for something like this, but I don’t want to use it as I have plans to do something else.

    Ok. Have you looked at this plugin’s source to see how it accomplishes it?

    Thread Starter ginji

    (@ginji)

    Of course. It pretty much didn’t make sense to me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I get the referrer URL?’ is closed to new replies.