Support

Account

Home Forums ACF PRO WP_Query and sub-fields Reply To: WP_Query and sub-fields

  • Sorry @acf-support / James, it’s working fine actually. Apologies.

    One thing I have noticed though and maybe good for another thread actually. But I also need to order the posts returned in time order. I have a custom field (within the same repeater) called ‘start_time’ and the posts need to be ordered by that… Any ideas how I modify my WP_Query for that?

    <?php
      $args = array(
        'posts_per_page' => -1,
        'post_type'      => 'schedule',
        'order'          => 'ASC',
        'orderby'        => 'meta_value_num',
        'meta_key'       => 'schedule_time_slot_%_schedule_date',
        'meta_query'     => array(
         array(
           'key'     => 'schedule_time_slot_%_schedule_date',
           'compare' => '=',
           'value'   => $mon,
           'type'    => 'DATE',
         )
        )
    );
    ?>

    Your help is much appreciated.