• I’ve got a site pretty much based on a CPT-onomy of Artists in development, and one of the things I’m totally stuck on is listing a CPT (Publications) segmented by the Artists CPT-onomy.

    No matter what I try, I can’t get the Artists to order with this tax_query. Can anyone shed some light on what’s wrong, or suggest an alternative way?

    The Publications order fine in each group, but the Artist section are in some kind of random order, no matter what I try.

    Here’s the code I’v got currently:

    $custom_terms = get_terms('artists');
    
    foreach($custom_terms as $custom_term) {
        wp_reset_query();
        $args = array(
        	'post_type' => 'publications',
        	'posts_per_page' => -1,
            'tax_query' => array(
                array(
                    'taxonomy' => 'artists',
                    'field' => 'slug',
                    'terms' => $custom_term->slug,
    		'orderby' => 'name',
            	'order' => 'ASC',
                ),
            ),
            'orderby' => 'name',
            'order' => 'ASC',
         );
    
    $loop = new WP_Query( $args );

    The site’s not public, but here’s a screenshot of the output in question:

    https://www.evernote.com/shard/s2/sh/3cdb6943-0b66-4808-9a57-83f84699976d/d11c642de2ea3eb31e8132a2268bb888

    It’s the Artists’ names on the left that I can’t get to order in any coherent way.

    Thanks,
    Michael

    https://ww.wp.xz.cn/plugins/cpt-onomies/

The topic ‘tax_query ordering seems impossible…’ is closed to new replies.