문제

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