Querying Two Custom Post Types with OR Not Working

Question

I’m trying to query two custom post types – I want all research_article to return, but only events that are in the future. My events are working as expected, but I’m not getting any research_article posts appearing. What’s going wrong here?

$today = date( 'Y-m-d' );
        $args = array(
            'post_type'   => array('research_article', 'events'),
            'meta_key'    => 'wpcf-date_time',
            'post_status' => 'publish',
            'orderby'     => 'meta_value',
            'order'       => 'DESC',
            'meta_query' => array(
                array(                    // THIS ONE WORKS
                'key' => 'wpcf-date_time',
                'value' => $today,
                'compare' => '>=',
                'type' => 'DATE',
                ),
                array(
                  'key'      => 'pub_date', // THIS DOESNT WORK
                  'compare'  => 'EXISTS'
                ),
                'relation' => 'OR',
            )
             );

0
rainy 2 years 2021-03-21T18:23:06-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse