Multiple Custom Post Type queries, how to DRY it up
The below example is your code in a loop. The post_types array includes all the post types that you’re querying. Then, the next bit (foreach, more info here) runs the code wrapped in curly braces ({ to }) for each item in that post_types-array. post_types = array(‘recipes’, ‘value_chain’, ‘press’, ‘multimedia’); foreach($post_types as $post_type){ $query = … Read more