Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
Are you using any caching plugins like super cache? –  Otto Nov 1 '13 at 1:04
add comment

2 Answers

up vote 1 down vote accepted

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).
share|improve this answer
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
add comment

did you try the get_query_var function ?

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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