I am using ACF to get the taxonomy, How to I get $place (which is the selected taxonomy) and add it to the installgallery_places post query? My code is:
<?php $place = get_field('choose_place', 'installgallery_places'); $args = array( 'post_type'=> 'installgallery', 'installgallery_places'=> '$place' );
$the_query = new WP_Query( $args ); if($the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
I believe you can do it like that
$args = array(
'post_type'=> 'installgallery',
'meta_query' => array(
array(
'key' => 'installgallery_places',
'value' => $place,
)
)
);
Maybe it could work with you original code if you remove the single quotes around the variable $place
Worked this one out from trial and error, had to change the ACF taxonomy to 'Term Object' in the Return Value and used the following code to return the slug:
<?php
$variable = get_field('choose_place');
$args = array(
'post_type'=> 'installgallery',
'installgallery_places' => $variable->slug
);
$the_query = new WP_Query( $args );
Thanks for your help on this one