Query events with WP_Query not working
-
Hi, I’m trying to query events with WP_Query, but something weird is happening.
If i try to query just events, there’s no result, but if instead of ‘tribe_events’ or array( ‘tribe_events’ ) I set post_type to array( ‘tribe_events’, ‘post’ ), the loop works and show the title of posts and events.
That’s my code:
$args = array( 'post_type' => 'tribe_events', 'posts_per_page' => 3 ); $events = new WP_Query( $args ); if( $events->have_posts() ) : while( $events->have_posts() ) : $events->the_post(); the_title( '<h3>', '</h3>' ); endwhile; wp_reset_postdata(); endif;
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Query events with WP_Query not working’ is closed to new replies.