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