That’s weird. I’ve just tested it on my end and wpdb class was working with the
get_field() result. Maybe there’s something on your site that modifies the query. Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.
It’s also possible that there’s something wrong with your custom table. Could you please try to get the entries from the
wp_postmeta table like this:
global $wpdb; $varA = get_field('city'); $varB = $wpdb->get_results($wpdb->prepare( " SELECT * FROM wp_postmeta WHERE meta_value = %s ", $varA )); print_r( $varB );
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 Advanced Custom Fields.