Support

Account

Home Forums ACF PRO Order terms in taxonomy query Reply To: Order terms in taxonomy query

  • Hi @anybodesign

    The “acf/fields/taxonomy/query” is used to query the taxonomies on the backend. If you want to sort it on the front-end, you need to sort it manually using array_multisort() like sorting a repeater. This page should give you more idea about it: http://www.advancedcustomfields.com/resources/how-to-sorting-a-repeater-field/.

    So you can do it like this:

    $value = get_field('taxonomy', '76');
    $order = array();
    // populate order
    foreach( $value as $i => $row ) {
    	$order[ $i ] = $row->count;
    }
    array_multisort( $order, SORT_ASC, $value );
    
    print_r($value);

    I hope this helps.