我有下面的代码,它以数组的形式打印一个逗号分隔的列表,如何将id列表放入一个名为$excluded\\u categories的数组中,其内容如下所示?
$categories = get_categories(array(\'taxonomy\'=>\'projects_category\', \'exclude\'=>7, \'orderby\'=>\'id\'));
if ( !empty( $categories ) ) :
foreach($categories as $term){
echo $term->term_id.\', \'; // prints: 1,2,3,4,5,6,8,9,
}
endif;
$excluded_categories would be an array containing: 1,2,3,4,5,6,8,9