I wanted to sort product by some items like price, date, and release year. in case of release year, I made a taxonomy=release-year&post_type=product and set year for it. now i want to sort by year. the code i have is this:
case 'rand' : $curr_args['orderby'] = 'rand'; break; case 'date' : $curr_args['orderby'] = 'date'; $curr_args['order'] = $order == 'ASC' ? 'ASC' : 'DESC'; break; case 'price' : global $wpdb; $curr_args['orderby'] = "meta_value_num {$wpdb->posts}.ID"; $curr_args['order'] = $order == 'DESC' ? 'DESC' : 'ASC'; $curr_args['meta_key'] = '_price'; break; case 'popularity' : $curr_args['meta_key'] = 'total_sales'; add_filter( 'posts_clauses', array( WC()->query, 'order_by_popularity_post_clauses' ) ); break; case 'release-year' : $curr_args['orderby'] = 'release-year'; $curr_args['order'] = $order == 'ASC' ? 'ASC' : 'DESC'; $curr_args['tax_query'] = array(array('taxonomy' => 'release-year', ); ); case 'title' : $curr_args['orderby'] = 'title'; $curr_args['order'] = $order == 'DESC' ? 'DESC' : 'ASC'; break;
but it is not working. how can i change the code to possible sort by release year order?