Title: Secure $_GET
Last modified: August 19, 2016

---

# Secure $_GET

 *  Resolved [moones](https://wordpress.org/support/users/moones/)
 * (@moones)
 * [17 years ago](https://wordpress.org/support/topic/secure-_get/)
 * Hello,
 * I have the following code in my WP:
 * `<?php $bg = $_GET['q']; if ($bg == black) {?> output <?php } else {} ?>`
 * So, if I put in URL somesite.com?q=black, then I will get the output. It works.
 * My question is about potential security issues with this method. Is it safe or
   should I filter or sanitize the variables and how do I do so.
 * Thanks.

Viewing 1 replies (of 1 total)

 *  Thread Starter [moones](https://wordpress.org/support/users/moones/)
 * (@moones)
 * [17 years ago](https://wordpress.org/support/topic/secure-_get/#post-1101303)
 * Here it is:
 *     ```
       <?php if(isset($_GET['q']) && $_GET['q'] == black) {?> do something <?php }?>
       ```
   

Viewing 1 replies (of 1 total)

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [moones](https://wordpress.org/support/users/moones/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/secure-_get/#post-1101303)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
