I've got a custom post type that I've sorted by date from an ACF date picker field. I need to be able to filter these results based on a custom taxonomy that I've got. I can't seem to work out where to add the tax_query array. Keeps breaking the site. Taxonomy name is 'pre_job_status', term to filter by is 'survey-complete' Currently I have the following code
<?php
// get posts
$posts = get_posts(
'tax_query' => array(
array(
'taxonomy' => 'pre_job_status',
'field' => 'slug',
'terms' => array( 'survey-complete' )
),
),
array(
'post_type' => 'pre_jobs',
'posts_per_page' => -1,
'meta_key' => 'survey_date',
'orderby' => 'meta_value',
'order' => 'ASC',
));
if( $posts ): ?>
<hr>
<ul>
<?php foreach( $posts as $post ):
setup_postdata( $post )
?>
<?php $requestor = get_field('pre_job_requestor', $client->ID ); ?>
<?php $survey_site = get_field('survey_site', $client->ID ); ?>
<li>
<?php the_field('survey_date'); ?> - <a href="<?php the_permalink(); ?>"><?php the_title(); ?> - <?php echo $requestor[0]->post_title; ?> - <?php echo $survey_site[0]->post_title; ?></a>
</li><hr>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata(); ?>
<?php endif; ?>