How to pass extra variables in URL with Wordpress
Posted
by
Chuck D
on Stack Overflow
See other posts from Stack Overflow
or by Chuck D
Published on 2011-01-03T17:44:38Z
Indexed on
2011/01/03
17:54 UTC
Read the original article
Hit count: 202
I am having trouble trying to pass an extra variable in the url to my wordpress installation.
For example /news?c=123
For some reason, it works only on the website root www.example.com?c=123
but it does not work if the url contains any more information www.example.com/news?c=123
. 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?
© Stack Overflow or respective owner