Вопрос

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...

Это было полезно?

Решение

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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top