0

Question: I have many custom post types and i want to return all the posts by just a few of the post types:

For example i have an array and was wondering if there was a way of passing this array to something like the get_posts function and it returning all the post types specified in the array.

Example array:

post_types = [ 
event,
award,
upcoming 
]

The above array would be passed to said function and i would be returned all posts matching only those in the array,

2
  • There's that exact parameter documented in the official WP_Query reference page with examples – Tom J Nowell Apr 6 '20 at 21:44
  • @TomJNowell looks perfect thank you. – Anon12 Apr 7 '20 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.