Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Context Post Type: Resources Taxonomy: Media Type, Term: Audio Taxonomy: Series

The following code displays a unique list of the custom taxonomy "Series"

I want to order the list by term_order, but it is not working. Help please! Thanks!

The site: http://eaglesonline.org/resources/audio/ currently it's ordered by ID

                $post_data = array();

                $my_query = new WP_Query( array( 
                        'post_type' => 'resource',
                        'posts_per_page' => -1,
                        'media_type' => 'audio'


                if ( $my_query->have_posts() ) {
                    while ( $my_query->have_posts() ) {
                        $post_data[] = get_the_ID();

// Start with whatever ID you want to have from Media Type
                $audio = 16;

                // Get all those post_ids for that term
                $post_ids = get_objects_in_term( $audio, 'media_type', array('post_status' => 'publish') );

                // Then get the series terms for those post ids
                $terms = wp_get_object_terms( $post_data, 'series', array('fields' => 'ids', 'orderby' => 'menu_order' ) );
                $result = array_values( array_unique($terms) );


        $a = $result;

        foreach ($a as $v) {
        $term = get_term( $v, 'series' );
        $name = $term->name;
        $slug = $term->slug;
        echo '<div class="resource-item"><a href="'.get_term_link($slug, 'series').'" title="'.$name.'"><div class="play"></div><li>'.$name.'</li></a></div>';      

share|improve this question

1 Answer 1

Instead of menu_order try term_order.

According to documentation on the Codex, wp_get_object_terms supports:

'name', 'count', 'slug', 'term_group', 'term_order', and 'term_id'.

share|improve this answer
It did not seem to do the trick. –  izharbuen Mar 26 '13 at 5:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.