Order by taxonomy Value

I do want to order CTP by year. I have a taxonomy called ‘annee’ (year), and a CTP called ‘moto’ (motorbike). Issue is, when im trying to order by the taxonomy, it’s ordering only by taxonomy ID, and not by Taxonomy Value. Do you have any solution ?

if ( is_post_type_archive( ‘motos’ ) ) {

$query->set( ‘posts_per_archive_page’, 24 );
$query->set( ‘order’, ‘DESC’ );
$query->set( ‘orderby’, ‘meta_value_num’ );
$query->set( ‘meta_key’, ‘annee’ );

Thank you.

Read more here:: Order by taxonomy Value

Leave a Reply

Your email address will not be published. Required fields are marked *