Can someone tell me how to pass a variable into WordPress from an incoming URL? For example, I have a visitor following this link:
When they arrive at my wordpress site, I want to pull that “white” variable and store it for future use in my MailChimp list and departing links like this:
- store mailchimp color
- http://mySecondWebsite.com?favoriteColor=white
I want this to be temporary and specific to this user only. I understand the concept and use of session_start(), but I have no idea how to use this in conjunction with WordPress. Any help is appreciated.
You can use the GET variables to fetch information from a URL. You can read out the
$_GET
array in PHP to get to your variable.The part thats tricky, is that inside your wordpress application, you should check out if the user is logged in, and then update the users’ information based on the current session. This is basically what you’re looking for.
If the user is not logged in already, you can ofcourse not update his account by just that URL. You’d then need to add more info – something like a hash in the URL thats unique for this user and allows you to update a preference without logging in.