Title: Custom querys broken? ($_Get variables -&gt; Custom_Archives)
Last modified: August 20, 2016

---

# Custom querys broken? ($_Get variables -> Custom_Archives)

 *  [James Jennett-Wheeler](https://wordpress.org/support/users/jwheeler91/)
 * (@jwheeler91)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/custom-querys-broken/)
 * I’m trying to get $_Get style variable on my permalinks of just one page. It’s
   the live events page.
 * So I want links like “[http://strawsmusic.loc/live/?event=1330232400&#8221](http://strawsmusic.loc/live/?event=1330232400&#8221);
   but they just get converted to “[http://strawsmusic.loc/live/&#8221](http://strawsmusic.loc/live/&#8221);.
 * I followed these steps in the codex, but they don’t seem to work?
    [http://codex.wordpress.org/Custom_Queries#Custom_Archives](http://codex.wordpress.org/Custom_Queries#Custom_Archives)
 * I should mention that I am running wordpress in MAMP. I tried it with Twenty 
   Eleven to see if it was my theme, but I guess not…
 * Here is the code I added to functions.php
 *     ```
       add_filter('query_vars', 'event_queryvars');
       function event_queryvars($qvars) {
         $qvars[] = 'event';
         return $qvars;
       }
       ```
   
 * And in the relevant template file:
 *     ```
       global $wp_query;
       if (isset($wp_query->query_vars['event'])) {
       	$event = esc_attr($wp_query->query_vars['event']);
       }
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [James Jennett-Wheeler](https://wordpress.org/support/users/jwheeler91/)
 * (@jwheeler91)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/custom-querys-broken/#post-2420656)
 * **Edit**: With a bit more testing, I have discovered that the variable is picked
   up at the root web address so: [http://strawsmusic.loc/?event=1330232400](http://strawsmusic.loc/?event=1330232400)
   works (kinda).
 * But this isn’t useful for me. I want it linked to the “/live/” page…
 * So when i add the code to my events.php template,
 *     ```
       global $wp_query;
       if (isset($wp_query->query_vars['event'])) {
       	$event = esc_attr($wp_query->query_vars['event']);
       	echo $event;
       }
       ```
   
 * So it doesn’t work to use “/live/?event=1330232400”
 *  [Andrew Nacin](https://wordpress.org/support/users/nacin/)
 * (@nacin)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/custom-querys-broken/#post-2420928)
 * Moving to “Plugins and Hacks.” This is a question about canonical redirects, 
   query variables, and such, not about 3.3 beta or RC.
 *  Thread Starter [James Jennett-Wheeler](https://wordpress.org/support/users/jwheeler91/)
 * (@jwheeler91)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/custom-querys-broken/#post-2420935)
 * You can close it if you like,
 * While I’d still like an answer, I found an alternative using Div IDs, JavaScript
   and adding # with event id to the url.
 * its not ideal as the client has to be served more information then needed (which
   would otherwise be handled and shortened by the server…

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom querys broken? ($_Get variables -> Custom_Archives)’ is closed
to new replies.

## Tags

 * [add_filter](https://wordpress.org/support/topic-tag/add_filter/)
 * [query_vars](https://wordpress.org/support/topic-tag/query_vars/)

 * 3 replies
 * 2 participants
 * Last reply from: [James Jennett-Wheeler](https://wordpress.org/support/users/jwheeler91/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/custom-querys-broken/#post-2420935)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
