Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › ASC order is not correct › Reply To: ASC order is not correct
January 10, 2023 at 10:47 am
#40837
Keymaster
Okay, I see the issue now – the ordering there is not by date, but by ID.
To force an ordering by ID, then you may need a bit of custom code. Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
add_filter("asp_query_args", "asp_order_by_id", 10, 2);
function asp_order_by_id($args, $search_id) {
$args['post_primary_order'] = "id ASC";
return $args;
}
This will do the trick.