Home › Forums › General Issues › Multi Select – Get all choices for Query Args › Reply To: Multi Select – Get all choices for Query Args
$event_categories = get_field('event_categories');
var_dump($event_categories);
gives us
array(2) { [0]=> object(WP_Term)#4557 (11) { [“term_id”]=> int(179) [“name”]=> string(7) “Virtual” [“slug”]=> string(7) “virtual” [“term_group”]=> int(0) [“term_taxonomy_id”]=> int(179) [“taxonomy”]=> string(14) “event_category” [“description”]=> string(0) “” [“parent”]=> int(0) [“count”]=> int(3) [“filter”]=> string(3) “raw” [“meta”]=> array(0) { } } [1]=> object(WP_Term)#4445 (11) { [“term_id”]=> int(180) [“name”]=> string(5) “Local” [“slug”]=> string(5) “local” [“term_group”]=> int(0) [“term_taxonomy_id”]=> int(180) [“taxonomy”]=> string(14) “event_category” [“description”]=> string(0) “” [“parent”]=> int(0) [“count”]=> int(1) [“filter”]=> string(3) “raw” [“meta”]=> array(0) { } } }
and
array(1) { [0]=> object(WP_Term)#4581 (11) { [“term_id”]=> int(180) [“name”]=> string(5) “Local” [“slug”]=> string(5) “local” [“term_group”]=> int(0) [“term_taxonomy_id”]=> int(180) [“taxonomy”]=> string(14) “event_category” [“description”]=> string(0) “” [“parent”]=> int(0) [“count”]=> int(1) [“filter”]=> string(3) “raw” [“meta”]=> array(0) { } } }
with two categories chosen and three for number of events.
So as these are two arrays with arrays we get
NULL
Warning: foreach() argument must be of type array|object, null given in /Users/jasper/code/site/wp-includes/class-wp-list-util.php on line 164
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.