tax_query with an ‘OR’ relation. This means that the query will fetch posts that meet either condition: they are ‘landing-pages’ with the specified taxonomy terms, or they are any of the other specified post types without additional taxonomy constraints.
$args = array(
'posts_per_page' => 6,
'post_status' => 'publish',
'order' => 'DESC',
'post_type' => array('news', 'videos', 'webinars', 'whitepapers', 'testimonials', 'landing-pages'), // Include all your target post types
'tax_query' => array(
'relation' => 'OR', // Important for combining different post type conditions
array(
'taxonomy' => 'landing_pages_display_home',
'field' => 'slug',
'terms' => 'displayed-on-home-page',
// Ensure only 'landing-pages' post type is affected by this taxonomy query
'include_children' => false,
'operator' => 'IN'
),
array(
'operator' => 'EXISTS', // This allows posts of other types without further conditions
)
)
);
$resources = new WP_Query($args);