Skip to content

Instantly share code, notes, and snippets.

@janisdonis

janisdonis/short

Last active Aug 29, 2015
Embed
What would you like to do?
Wordpress multi taxonomy query with ACF repeater field
<?php
$args = array(
'post_type' => 'products',
'tax_query' => array(),
);
if(get_field('multi_filter') ) {
$temp = array();
while(has_sub_field('multi_filter')){
$_temp = array(
'taxonomy' => get_sub_field('taxonomy'),
'field' => 'slug',
'terms' => get_sub_field('term'),
'operator' => 'AND',
);
}
$args['tax_query'] = $_temp;
}
$query = new WP_Query( $args );
?>
<?php if ( $query->have_posts() ) : ?>
<?php while ($query->have_posts() ) : $query->the_post(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment