Post Class for Custom Taxonomy Error

As a quick fix I looped through each custom taxonomy type.

if ( ! function_exists('custom_taxonomy_class') ) {

    function custom_taxonomy_class($classes, $class, $ID) {

       $args = array(
         'public'   => true,
         '_builtin' => false

       ); 
       $output="names"; // or objects
       $operator="and"; // 'and' or 'or'
       $taxonomies = get_taxonomies( $args, $output, $operator ); 
       foreach ($taxonomies as $key) {

        $terms = get_the_terms( (int) $ID, $key );

                if ( ! empty( $terms ) ) {
                    foreach ( (array) $terms as $order => $term ) {            
                        if ( ! in_array( $term->slug, $classes ) ) {
                            $classes[] = $term->slug;
                        }
                    }
                }
       }
       $classes[] = '';
       return $classes;
    }
}
add_filter( 'post_class', 'custom_taxonomy_class', 10, 3 );