Support

Account

Home Forums General Issues Custom query filtering & ordering by ACF fields Reply To: Custom query filtering & ordering by ACF fields

  • Honestly, I don’t know why it’s not working, unless it has something to do with the mix of meta settings. Try this

    
    $today = date('Ymd');
    $thePosts = new WP_Query(array(
    'post_type'        => 'post',
    'posts_per_page'   => 10,
    'meta_query'       => array(
    	array(
    		'key'      => 'event_end',
    		'value'    => '".$today."',
    		'compare'  => '>'
    	),
        'date_clause' => array(
          'key' => 'event_start'
          'compare' => 'EXISTS'
        )
    ),
    'orderby' => array('date_clause' => 'DESC'),
    'post_status' => 'publish',
    ));