Support

Account

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

  • Automatic cleanup will be difficult no matter what information is stored.

    When would the cleanup happen?
    Each of the following conditions would leave behind orphaned data and would have its own problems and hurdles to jump. Some of them are more complicated to achieve than others.

    • When a field is deleted
    • When a field group is deleted
    • When the location of a field group is changed
    • When a field is hidden by conditional logic
    • When the sub fields of a repeater/flex field/clone change
    • When a field is moved from one field group to another – should data be deleted or moved?
    • When the parent of a field is changed (When a field is dragged into a different location, for example one repeater to another) – should data be deleted or moved?
    • When the field name is changed – should data be deleted or moved?
    • I’m sure I’m missing others

    What data do you think ACF could store to help make the clean up of data in each of the above conditions easier?

    How could ACF overcome the limits of WP when it comes to the issue of performing all of the checking and deletion of data from the five locations where it can be stored (_postmeta, _termmeta, _usermeta’, _commentmeta and options) when each check/deletion will require calling a WP function to delete the specific data? If the answer to some of the conditions is that data would be move then this will also require calling the WP function to insert the data in the new location. How can this be performed on a large site on every post without causing the admin to time out due to the number of db queries that must be performed?