Support

Account

Home Forums ACF PRO Orderby different meta_key than query Reply To: Orderby different meta_key than query

  • Seemed to have fixed it by using this. Maybe someone knows if this is the correct way? Maybe there’s a cleaner way?

    $locs = get_posts(array(
    	'posts_per_page'	=> -1,
    	'post_type'			=> 'locations',
    	'orderby' 			=> 'monday_start_time',
        'order'				=> 'ASC',
    	'meta_query' => array(
            array(
                'key'     => 'monday_start_time',
                'value'   => '',
                'compare' => '!=',
            ),
        )
    ));