how to query order by a numeric ACF field

I created a query for the custom post type of “departments” the query gets me every department with ACF field “type\_of\_cetifecate” = “bach” and with a certain category id, until this point everything is working fine, but when I try to sort the query by certain numeric acf fields the query doesn’t work, my code so far:

$bachelor= new wp_Query(array(
‘post_type’ => ‘departments’,
‘posts_per_page’ => -1,
‘meta_key’ => ‘new_price’,
‘orderby’ => ‘meta_value_num’,
‘order’ => ‘DESC’,
‘category__and’ => get_field(‘category_id’),
‘meta_key’ => ‘type_of_cetifecate’,
‘meta_value’=> ‘bach’ )); ?>

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer