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

  • Yes it does. What my code does is this

    1) It queries every table for the value that matches the ACF field key
    2) It constructs a list of “name” values where one is the field name and the second is “_{$field_name}” which holds the field key
    3) It deletes all of the values for this field name

    This is only safe for field that will have unique names in the database. This would not be safe if you have fields that are named the same. There is really nothing that I can do about this.

    It is a crude hack to do something that is really impossible to do safely without a lot of time and work involved.

    This is why I added the warning and that any time you’re messing with the DB in this way you should have reliable backups of your DB.