Per http://codex.wordpress.org/Class_Reference/WP_Query you would need to prefix the numerical identifier of the array with a minus-sign, such as $query = new WP_Query( 'cat=-12,-34,-56' );
, which would exclude the categories with the identifier 12, 34 and 56.
You could achieve this by changing the get_cats
function into the following:
function get_cats(){
$exclude_cats = array(
get_cat_ID('test1'),
get_cat_ID('test2'),
get_cat_ID('test3'),
);
foreach ($exclude_cats as $item) {
$array[] = '-'.$item;
}
return $array;
}
Which returns the array exactly as before, except each item has a minus-sign prepended to it.