WP_Query not ordering correctly


I have two custom user meta fields created with ACF. One is quantidade_corretas_dia_4 (Numeric, integer) and another tempo_dia_4 (Numeric, decimal). I am using WP_User_Query to get users ordered by both this values like this:

    $args = array(
        "fields" => "ids",
        "number" => -1,
        "meta_query" => array(
            "relation" => "AND",
            "query_one" => array(
                "type" => "NUMERIC",
                "key" => "quantidade_corretas_dia_4"
            "query_two" => array(
                "type" => "DECIMAL",
                "key" => "tempo_dia_4"
        "orderby" => array(
            "query_one" => "DESC",
            "query_two" => "ASC"


    $user_query = new WP_User_Query($args);

    $users = $user_query->get_results();

However, i cannot understand why my results are being ordered by quantidade_corretas_dia_4 but not by tempo_dia_4. Here is an example of what i get:

enter image description here

I expected user with ID 44 to be placed before user with ID 65, since they have same quantidade_corretas_dia_4 but tempo_dia_4 is different (lesser in ID 44 than ID 65).

What am i doing wrong in this query?


, , , , joann2555 5 months 0 Answers 66 views 0

Leave an answer