Support

Account

Home Forums ACF PRO Query Posts by Relationship field and then orderby Date picker field Reply To: Query Posts by Relationship field and then orderby Date picker field

  • Hmmm, no replies at all. Geez, didn’t think my question was that out there.

    Anyways, if anyone else has the same question here is how ended solving my issue.

    $member_id = get_the_ID();
    $meta_query = array(
        array(
    	'key' => 'podcast_pub_date',
    	'value' => date('Ymd'),
    	'type' => 'DATE',
    	'compare' => '<='				   
        ),
        array(
    	'key' => 'podcast_authors',
    	'value' => $member_id,
    	'compare' => 'LIKE'
        )
    );
    			   
    $podcast_args = array(
        'post_type' => 'podcasts',
        'posts_per_page' => 3,
        'meta_key' => 'podcast_publication_date',
        'orderby' => 'meta_value_num',
        'order' => 'DESC',
        'meta_query' => $meta_query
    );

    I don’t have a ton of test data yet and still are testing this but seems to be working as I need it to.