Top level categories will have value 0 for the parent, so check that before adding to the array:
foreach( $categories as $category ) {
if( 0 != $category->parent ) {
array_push( $cat_ID, $category->cat_ID );
}
}
Top level categories will have value 0 for the parent, so check that before adding to the array:
foreach( $categories as $category ) {
if( 0 != $category->parent ) {
array_push( $cat_ID, $category->cat_ID );
}
}