• Resolved tristanbethe

    (@tristanbethe)


    Hi Lester,

    I found out I had a huge number of Duplicated Post Meta’s in my woocommerce products. I’ve cleared out by hand most of them using Adminer and just looking at where the repetition started and deleted from there.

    Still Sweep informs me there are still 63,610 of them or 28.06%. Before I hit the sweep button I like to understand what will happen.

    a) Does Sweep go from post to post and sees if there a duplicate in that post only and removes the extra ones? Very much as I did with adminer?

    b) Does it remove duplicates over the whole post_meta database? So if I have 2 post them of course I would have 2 of the same post_meta’s.

    I do not think it’s B but I also cannot completely make it up from the text.

    Thanks for any insight you could give..

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Lester Chan

    (@gamerz)

    It runs a SQL statement, do determine the duplicate item and call WP function to remove it.

    This is the code it use to find the duplicate and running this will show you the count.

    
    SELECT COUNT(meta_id) AS count, meta_key FROM wp_postmeta GROUP BY post_id, meta_key, meta_value HAVING count > 1
    

    As always, remember to backup your DB before running Sweep. There are just too many plugins in WP that it is impossible to make it 100% safe.

    • This reply was modified 9 years, 1 month ago by Lester Chan.
    Thread Starter tristanbethe

    (@tristanbethe)

    Thanks, I am just using queries to adjust a database since yesterday 🙂 GROUP BY post_ID is what I think I was looking for in my a) scenario.

    Hey I’ve got a backup.. what can go wrong? Thanks for your continued effort with these plugins.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Duplicated Post Meta’ is closed to new replies.