سؤال

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