Support

Account

Home Forums Bug Reports Meta is being duplicated in database Reply To: Meta is being duplicated in database

  • I can’t say when the duplicate meta table rows where created or what caused them.

    I’ve been looking into how ACF gets and updates meta values. It uses the form

    get_post_meta($post_id, $meta_key, false);

    This means it is getting both values. I have been unable to figure out why it chooses the second value or the first value inconsistently.

    When it updates the value it includes the previous value, it doesn’t exactly use this function but what it does is the equivalent

    update_post_meta($post_id, $meta_key, $meta_value, $prev_value);

    Which is why one value is updated and the other value is not, I think.

    Wish I could be more help. However it happened it looks like I was correct. The only way to correct the problem will be to go through the database and manually delete the duplicate meta_key rows for each post_id where they are causing a problem.