2

My website gets called from a referrer with a zip code in the url as a parameter like this:

http://example.org/?zip=47800

But if I click another link on my site, the parameter is lost!

How can I keep this parameter permanently on the site or use it for the current session?

0

1 Answer 1

0

I can't gibe a full answer but at least I'll try to give some pointers: You'll first have to grab the parameter from the URL, pass it to WP and then add the parameter to your links. I'm not aware of any plugin that would do all the three steps out of the box – but there are some fragments available. You would 'only' have to put them together and load them as a plugin:

  • This ('abandoned') plugin could be a starting point, even though it seems not to grab the parameter from the URL. It however seems to provide some sort of 'link interception' functionality, adding parameters to 'all' the links: YD Spread Parameter

  • For the 'URL grabbing' part you'll need a function that a) grabs the parameter AND b) passes it to WordPress. Here is a short tutorial on how to do this: Passing Query String Parameters in WordPress URL

3
  • Thanks Till ! I'll have a loot at your links ... I've seen so many questions regarding this feature - but it seems no one ever found a perfect solution for this :-/ I guess whoever programs this a plugin could sell it and make a lot money with it :-) Commented Sep 9, 2015 at 10:04
  • yep, I was thinking of that too – but I suppose it's not really trivial since taking parameters from the url and processing them could actually be a security risk… But that's probably why it would be really a good idea to have a secure plugin handle this. Maybe my first 'pro-plugin'? :) Cheers! Commented Sep 9, 2015 at 13:12
  • 2
    please don't include external links as the only informative part of your answer. external links die or worse they change. Commented Sep 10, 2015 at 6:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.