Chuck D Chuck D - 9 months ago 42
PHP Question

How to pass extra variables in URL with Wordpress

I am having trouble trying to pass an extra variable in the url to my wordpress installation.

For example


For some reason, it works only on the website root
but it does not work if the url contains any more information
. I have the following code in my functions.php file in the theme directory.

if (isset($_GET['c']))
setcookie("cCookie", $_GET['c']);

if (isset($_SERVER['HTTP_REFERER']))
setcookie("rCookie", $_SERVER['HTTP_REFERER']);

Any Ideas?


There are quite few solutions to tackle this issue. First you can go for a plugin if you want:

Or code manually, check out this post:

Also check out: