How do I get the referrer URL?
-
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)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How do I get the referrer URL?’ is closed to new replies.