Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WP_Query for gettings multiple post type in multiple taxonomy
get_posts([
'post_type' => ['headline', 'event'],
'numberposts' => 5,
'tax_query' => [
'relation' => 'OR',
['taxonomy' => 'event-category', 'field' => 'slug', 'terms' => 'featured'],
['taxonomy' => 'headline-categories', 'field' => 'slug', 'terms' => 'featured']
],
'order' => 'DESC'
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment