Querying multiple post types with different post statuses
-
Here is my WP_Query object:
$ls_any_posts = new WP_Query( array( 'post_type' => array('post', 'event', 'deal', 'contest', 'partner'), 'posts_per_page' => 5, 'meta_query' => array( array( 'key' => 'whats_hot', 'value' => 1, 'compare' => '=', ) ), 'post_status' => array('publish', 'future'), ) );
Currently, this queries for all my custom post types that have a status of Publish or Future.
Instead, I only want to query “Future” posts if the post type is “Event”. If it’s one of the other post types, the status must be “Publish”.
How could I accomplish that?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Querying multiple post types with different post statuses’ is closed to new replies.