1

I have this in my URL;

?utm_source=John%27s%20Source

I want to get the value using this;

echo rawurlencode(stripslashes($_GET['utm_source']));

That does not return anything. However, if I get rid of the _ on 'utmsource' in both the URL and the _GET, it will return this;

John%27s%20Source

Which is exactly what I am looking for. Why can I not do the same with the underscore?

RToyo
  • 2,877
  • 1
  • 15
  • 22
  • 2
    What do you see in `var_dump($_GET)` or even `var_dump(array_keys($_GET))`? I can't see any reason why you can't use the get index like that. – Scuzzy Nov 21 '17 at 22:16
  • 1
    didn't you post this already? https://stackoverflow.com/q/47422231/1415724 – Funk Forty Niner Nov 21 '17 at 22:16
  • Fred, I did post that, but that was a different issue I have since solved. – Joe Cuningham Nov 21 '17 at 22:19
  • It looks like the previous question has the GET variable as simply "utmsource". Is it possible you've got a mix of "old" code and new? Like your
    page has a target URL with `utmsource`, but the actual script looks for `utm_source`? A `var_dump` as @Scuzzy suggested would shed a lot of light on this.
    – RToyo Nov 21 '17 at 22:41
  • @Scuzzy I have 5 variables in the URL that start with utm_ var_dump(array_keys($_GET)) will return all of them if none have an underscore, but if any do have an underscore it will only return the variables before the one with the underscore. – Joe Cuningham Nov 21 '17 at 22:44

1 Answers1

2

I solved it.

So it turns out that by defualt WPEngine will not let you use '$GET' with something that starts with "utm". I guess this has to do with it being a Google search term and by default it is turned off. I found this thread and contacted WPEngine like the person in the thread, and now it works just fine.

Thanks for the help guys.

Having "utm_" in the URL string breaks the $_GET variable in Wordpress