Title: get_query_var or $_GET
Last modified: January 30, 2017

---

# get_query_var or $_GET

 *  [Bushstar](https://wordpress.org/support/users/bushstar/)
 * (@bushstar)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/get_query_var-or-_get/)
 * I’m a bit confused about this and I’ve not been able to find a definitive answer.
 * What is the best practice in regards to front end URL variables?
 * Can I grab using $_GET or should I be adding variables to WordPress with add_query_var
   and retrieving with get_query_var?

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/get_query_var-or-_get/#post-8716767)
 * If it’s going to be used in a posts query, make it a query var. I can’t think
   of a valid reason not to. If nothing else, it’s consistent with how WP itself
   works. In other situations, there may be little choice but to use one of the 
   PHP super globals. When you do, the data may be slashed, and you must take all
   the necessary steps to validate and sanitize the passed values.

Viewing 1 replies (of 1 total)

 The topic ‘get_query_var or $_GET’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/get_query_var-or-_get/#post-8716767)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
