You can add another array into your meta_query to include all posts from your second post type.
Given in your example, you have 2 post types
- events
- news
If you can pick a meta_key
that only exists for news
but doesn’t exist on events
, then this set of args would return all news post types and still filter on events.
$args = array(
'post_type' => array( 'news', 'events' ),
'meta_key' => 'end-date',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'end-date',
'value' => date ( 'Ymd' ),
'type' => 'NUMERIC',
'compare' => '>='
),
array(
'key' => 'my_unique_key_for_news',
'compare' => 'EXISTS'
),
'relation' => 'OR',
)
);
The relation => OR
is important. It says please return results that fit your end-dates
that are >=
today, OR all the items that match up on the key for news
(which would be all news items).
This way you are getting specific about the meta_values for events, but returning all results for news, and thus the filter leaves the second post type alone.