Support

Account

Home Forums General Issues Flush Unused Custom Fields Reply To: Flush Unused Custom Fields

  • Annoyingly i’ve already deleted all my fields and check this useful thread a bit too late to read the clean on delete possibilities.

    I’ve got around 4,000 posts with a lot of dead meta.

    Couldn’t this be achieved with a bit of SQL? Trying to piece it together but not my strongest field!

    post_type=’acf-field’, post_excerpt seems to be the name of the field in this case ‘post_startdatetime’

    post_meta.meta_key is then like this
    post_startdatetime
    _post_startdatetime

    So if the post_type=’acf-field’ are deleted could we loop through the post_meta.meta_key, check if there’s a matching posts.post_excerpt and if not delete the post_meta entry?

    But there’s there’s an entry per post with a name like ‘field_534fe013d9a0d’ though we would still get 75% of unused post_meta.