3

So I am having an issue where I can't pull variables such as mysite.com/?utm_campaign=testing unless I am logged in as admin or editor.

When logged out and just a regular users I can't grab any variables which start in utm_ such as utm_campaign. However utmcampaign works, and any other variable I try. Just not utm_ ones.

I disabled all my plugins but still have the same issue. Not sure where the filtering is coming from and not sure why it only filters when not logged in as admin.

I tried accessing the variable using three different methods: 1. Injecting PHP code using the "Code Insert Manager" plugin

 <?php echo $_GET['utm_testing']; ?> 
  1. Using the built-in function of formidablepro to grab the GET variables.

  2. Using the same code as #1 but inside my footer.php file of my template.

All have same results.

  • 1
    Are you using any caching plugins like super cache? – Otto Nov 1 '13 at 1:04
1

It's not a core behaviour to overwrite the global $_GET array, which means it's likely that something else then WordPress itself is the issue here.

I would suggest the following steps to debug the issue:

  • Disable all active plugins and revert to standard theme, see if the problem persists.
  • If the problem is still there, open the index.php in your document root and write var_dump($_GET); exit(); in the first line to see if the variable is making it through the webserver. If it isn't showing up now, it means that it is filtered for some reason by the webserver (i.e. bad .htaccess rule, or conflicting mod_security rule).
  • 1
    The issue was with our host caching the pages. Needed to specifically uncache certain pages and it worked. – Damainman Nov 5 '13 at 20:56
1

did you try the get_query_var function ?

  • Just tried it, but it doesn't appear to grab the variable either. That function doesn't grab it at all, even when logged in as admin. – Damainman Oct 31 '13 at 18:29
  • @Damainman get_query_var() does only grab the public query vars already registered by core if you don't add your custom ones using add_query_arg(). Look add the Codex Page linked above. – s1lv3r Oct 31 '13 at 18:48
  • @s1lv3r, thank you for the additional information. I understand that, but my issue is the variables work perfect only when logged in as admin. If I am not logged in as admin, the variables don't work at all. I am trying to avoid even using the get_query_var function. Which is why I am using $_GET.. I only tested to see if maybe a plugin or something registered the utm_ variable to wordpress or something. ... Also utmanything works even when not ADMIN, but utm_anything doesn't – Damainman Oct 31 '13 at 18:55
0

If you have a hosted solution check to see if any page caches are stripping/ignoring the values. Get Parameters generally require the page request to be processed by the origin server. If the request does not hit the origin then you will not get an opportunity to process the GET params - equally if the params are stripped upstream - you may receive the request but the params may no longer exist.

Data capture vs performance

d.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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