+2  A: 

Probably either $new_rules or $wp_rewrite->rules is not an array at the moment you want to combine them.

You could add a test to see if they are arrays, and if not, initialize them as an empty array.

(Addition: Why pass $rewrite as an argument, when you use a global to get the original variable?)

Jimmy Shelter
Beat me by five seconds. :) Welcome to SO.
Pekka
Thanks! Took me some time to find an unanswered question ;)
Jimmy Shelter
I passed it as an argument to test something, and didn't change it back in the example code provided.
Brad
wp_rewrite->rules is [rules] => Should I test like this? if ($wp_rewrite->rules == '') $wp_rewrite->rules = array();I'm not 100% sure on the correct way of doing this. Thanks-Brad
Brad
You can use is_array() to check if a variable is an array.So it would be:if (!is_array($wp_rewrite->rules)){ $wp_rewrite->rules = array(); }
Jimmy Shelter