// Variables $number_of_events = get_field( 'number_of_events' ); // print_r($number_of_events); $event_object = get_field_object('events_category'); // print_r($event_object); $event_cat_name = $event_object['value']; // print_r($event_cat_name); $cat_names = array_column($event_cat_name, 'slug'); print_r($cat_names); // $event_cat_slug = $event_cat_name->slug; // print_r($event_cat_slug); $args = array( 'post_type' => 'event', 'posts_per_page' => $number_of_events, 'tax_query' => array( array( 'taxonomy' => 'event_category', 'terms' => $cat_names ) ) );
Still does not filter though
$cat_names does print cats selected in multi select like when I choose onsite only:
Array (  => onsite )
terms should accept an array I understand but JS states
Error: Syntax error, unrecognized expression: Array (  => onsite ) <h2>Event 4 Virtual</h2> <h2>Event 3</h2> <h2>Event Two</h2>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future.— Advanced Custom Fields (@wp_acf) January 6, 2023
© 2023 Advanced Custom Fields.