How can I get only parent terms?

Yes, just pass in the parent parameter to get_terms when you call it, as Michael pointed out.

Since WP 4.5 this is the recommend usage:

$myterms = get_terms( array( 'taxonomy' => 'taxonomy_name', 'parent' => 0 ) );

Prior to WP 4.5 this was the default usage:

$myterms = get_terms( 'taxonomy_name_here', array( 'parent' => 0 ) );

Will return all terms that have a parent value of 0, ie. top level terms.

Leave a Comment