• Hello everyone,

    This is my first post here, I hoe this topic will be useful for many other people.

    Here is my problem : I have posts with custom fields information, and I would like to sort them with 2 meta_value.
    Here is my not working code :

    <?php
    $idf_dept = array ('75', '77', '78', '91', '92', '93', '94', ' 95'); // the list "departements" I want OR don't want depending on the user choice
     $mapposts = new WP_Query( array('post_status' => 'publish',
    								'post_type' => 'post',
    								'category_name' => 'en_cours',
    								'meta_query' => array(
    														array(
    															'key'     => 'dept_nb_for_the_order',
    															'value'   => $idf_dept,
    															'compare' => $compare,
    															'orderby' => 'meta_value',
    															'order' => ASC
    														),
    														array(
    															'key'     => 'city_name_for_the_order',
    															'orderby' => 'meta_value',
    															'order' => ASC
    														)),
    								) );
    ?>

    I’ve seen a lot of solutions, but not working for me… some are too old maybe.

    I hope one of you have an answer, I’m getting mad on this one !!
    Thanks a lot ??

  • The topic ‘OderBy two Meta’ is closed to new replies.