• I’m using The Events Calendar plugin but I thought I’d post it here as I believe this particular function works the same as get_posts().

    I’m trying to use the function to display only posts from one particular category (‘Lead Event’):

    <?php
    
    	$args = array( 'posts_per_page' => 5,
    				   'eventDisplay' => 'all',
    				   'tax_query', array(
    					   	array(
    					   		'taxonomy' => 'event-type',
    					   		'field' => 'slug',
    					   		'terms' => 'lead-event'
    					   )
    			       ),
    	);
    
    	$events = tribe_get_events( $args );
    
    ?>

    But it’s just returning 5 posts, regardless of which category they’re in

    I’ve also tried with the IN operator but still no luck:

    <?php
    	$args = array( 'posts_per_page' => 5,
    				   'eventDisplay' => 'all',
    				   'tax_query', array(
    					   	array(
    					   		'taxonomy' => 'event-type',
    					   		'field' => 'slug',
    					   		'terms' => 'lead-event',
    					   		'operator' => 'IN'
    					   )
    			       ),
    	);
    
    	$events = tribe_get_events( $args );
    
    ?>

    Can anyone see what I’m doing wrong?

  • The topic ‘Include Category With Tax Query’ is closed to new replies.