Question

I'm using a query string attached to external links to identify vendors visiting my Wordpress site. I need to save the query (currently using $_GET[]) to a session or cookie but am having no luck with either. Is there an easy way to accomplish this? (WP 3.8.2)

FYI I've been through and through other posts but turned up nothing useful...

Était-ce utile?

La solution

Url example: example.com?vendor=something

You can save to session or cookie like that:

$_SESSION['vendor'] = $_GET['vendor'];
setcookie('vendor', $_GET['vendor'], time()+86400); //For 1 day
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top