Support

Account

Forum Replies Created

  • Yes, I knew about the filters for it.

    Thanks for the plugin reference!

  • Like I said, it was definitely concerning…but since switching to all keys, I have not seen the problem again.

    It is a simple text field. As you can see in the image above, the code field with post_id of 490 was returning the field key ending in fb2, but this field key is associated with a completely different acf-group. The field key it should have been returning ended in ee.

    I wish I would have saved all the queries so I could show what I was seeing about a little better.

    I’ve never seen anything like that before.

  • I was using update_field(‘field_name’, $id) not the field key. And perhaps this was the issue.

    Largely the issue was that when I would use get_field it was returning a field with the wrong key…or at least differing from what was the expected key.

    As you pointed out, this may very well have been related to me using field_names instead of keys when updating a field.

  • 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.

  • By the way, I looked at db and that post does not have multiple entries for code. It only has one. So there shouldn’t be anything that would fumble the lookup. The strangest things as I said, was that it was working. The famous last words, “nothing changed”, heh. Obviously something changed, but it really seemed like the difference of refreshing the page.

    Here’s a pic of the db.

    null

Viewing 5 posts - 1 through 5 (of 5 total)