Title: query_vars crashes rewrite_rules_array
Last modified: August 21, 2016

---

# query_vars crashes rewrite_rules_array

 *  [HarroH](https://wordpress.org/support/users/harroh/)
 * (@harroh)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/query_vars-crashes-rewrite_rules_array/)
 * Hi Guys,
 * Want something pretty simple, basically wanna redirect every page to the index.
   php so i can dynamically load it there. So added this to my function.php
 *     ```
       add_filter('rewrite_rules_array', 'slug_rewrite_rules_flush');
   
       function slug_rewrite_rules_flush($rules) {
   
       	$newrules = array();
   
       	$new_rules['(.*)/?$'] = 'index.php?test=test';
   
       	return $new_rules+$rules;
       }
       ```
   
 * No problem, worked fine. However, I also want to be able to use the test variable
   I’m sending along. So added a query_vars hook.
 *     ```
       add_filter('query_vars','slug_rewrite_vars');
   
       function slug_rewrite_vars($vars) {
   
       	$vars[] = 'test';
   
       	return $vars;
       }
       ```
   
 * Problem is that when I add this, I get a totally white page, not errors, nothing.
   When I change ‘test’ inside the slug_rewrite_vars function to anything not related
   to test. So for example:
 *     ```
       add_filter('query_vars','slug_rewrite_vars');
   
       function slug_rewrite_vars($vars) {
   
       	$vars[] = 'ChangedThisVariable';
   
       	return $vars;
       }
       ```
   
 * …then it works again, but of course I cannot $_GET the test variable. Anyone 
   knows what I’m doing wrong?

The topic ‘query_vars crashes rewrite_rules_array’ is closed to new replies.

## Tags

 * [rewrite rules](https://wordpress.org/support/topic-tag/rewrite-rules/)
 * [Vars](https://wordpress.org/support/topic-tag/vars/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [HarroH](https://wordpress.org/support/users/harroh/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/query_vars-crashes-rewrite_rules_array/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
