Home › Forums › General Issues › get_fields not returning a specific value › Reply To: get_fields not returning a specific value
Hmmm, so I figured out the issue. It’s a little concerning to me, but perhaps it was because I was updating with names instead of keys. Perhaps making the change to keys will solve the issue.
Basically, the database was confused 🙂
I used this
`
public static function get_fields($id){
global $wpdb;
$rows = $wpdb->get_results(“SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = $id AND meta_value LIKE ‘field_%'”);
var_dump($rows);
exit();
}
`
And thought for a second that one of the keys looked familiar. If you look at the image above, you’ll see why it looked familiar….because the key that being returned for post 490 was the same key that was associated with 488. For a second, I thought maybe keys were just unique on posts, but then looking at the admin custom fields section keys, I realized that wasn’t the key at all that should be in the database for post 490. Somehow, ACF created a wrong entry for post 490 by using a field key that was not related to that post in any way.
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.