$plfsByState = $wpdb->get_results(" select pm.meta_value as state, count(*) as postcount from $wpdb->posts p join $wpdb->postmeta pm on p.ID = pm.post_id where p.post_type = 'plfmaps' and p.post_status = 'publish' group by state order by state ASC");
This gives me way too much data…And doesnt exactly work. This basically returns everything. I’m seeing div with the address, city, state. How can i modify this query to only show the states?
Where I am getting mixed up is the meta_key value for the location_state actually looks like this in the database table “locations_0_state” and “locations_1_state” — any ideas on this one? I feel like I am really close, but I’m missing something.
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!