Get top level categories / taxonomy

It’s not clear from the WP documentation how to get the top level taxonomies / category only (as you can see from threads like this. The trick is to have hide_empty=0.

Code Snippet:

<?php
$args = array(
    'type'          => 'post',
    'orderby'       => 'term_group',
    'hide_empty'    => 0,
    'hierarchical'  => 0,
    'parent'        => 0,
    'taxonomy'      => '..if you are using a taxonomy instead of a category'
);
get_categories( $args ); 
?>

Posted in Pure hacks