Skip to content

Instantly share code, notes, and snippets.

@janisdonis
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save janisdonis/a42283b57260516235ce to your computer and use it in GitHub Desktop.
Save janisdonis/a42283b57260516235ce to your computer and use it in GitHub Desktop.
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