jarednova/timber — pull request #291 by jarednova (2014-07-12 18:39:46+00:00)
Title: set default for header to be 200 to prevent WP from attempting further redirect

I've discovered an issue with WP's routing where a custom `Timber::add_route` will fail b/c WP recognizes part of the URL. While I don't think it's been formally established, the expected behavior for `Timber::add_route` is that it takes precedence over WP's routes.

## The current situation:

Let's say I have a post called "sports" in my DB, with a normal permalink at...

`http://example.org/2014/07/sports`

Now I want to add some custom routes. So I create...

#### Sample Route 1 (Works)
```
Timber::add_route('mything/whatever', function(){
Timber::load_template('archive.php');
});
```

#### Sample Route 2 (Fails)
```
Timber::add_route('mything/sports', function(){
Timber::load_template('archive.php');
});
```

In this instance **Sample Route 1** will work as expected and load-up `archive.php`. However, **Sample Route 2** will _start_ to work, but then WP's routing kicks into gear and sends the user to `http://example.org/2014/07/sports`. This can be solved by putting setting the `$force_header` param to `200`.

#### Sample Route 2 (Works)
```
Timber::add_route('mything/sports', function(){
Timber::load_template('archive.php', $fake_query, 200);
});
```

## But then...

However, after the site is launched and a user creates a post named "whatever" (as in the `post_name` is now equal to `whatever`). **Sample Route 1` will now fail. So the solution is to **always** put `200` as the header....

#### Sample Route 1 (Fails)
```
Timber::add_route('mything/whatever', function(){
Timber::load_template('archive.php');
});
```

#### Sample Route 1 (Works)
```
Timber::add_route('mything/whatever', function(){
Timber::load_template('archive.php', $fake_query, 200);
});
```

Of course, at this point, we're basically saying that for expected behavior a developer should override the defaults. In this PR, I set the header to default to `200`. This changes the current behavior. To restore the prior functionality, a dev would use:

#### Sample Route 1 (Old Style)
```
Timber::add_route('mything/whatever', function(){
Timber::load_template('archive.php', $fake_query, 0);
});
```