Support

Account

Home Forums Feature Requests When a field is deleted, also delete previously saved data

Solving

When a field is deleted, also delete previously saved data

  • If I have a custom field for a post and I add data into that post’s custom field, then delete the field, the data is still preserved in the database. When deleting a field it would be nice to have an option to also remove all data previously saved into that field.

  • On a small scale, and under the right conditions, this might be possible, but it is not scalable. On large sites it will fail due to the number of queries involved. If a site has fields with duplicate field names for different fields there is a hazard of deleting data that should not be deleted. These are just 2 of the potential reasons it’s never been done. Over the last 6+ years I’ve been helping on this forum this topic has come up more times than I can remember. There simply is no full-proof way that this can be done without causing other issues in many cases. The solutions that are available for removing data require that developers use specific development practices, like never using the same name for fields or using special prefixes for fields, and the list goes on. Practices that the average dev will never use until they realize the importance of using them, which is usually too late to do anything about it. They also require doing queries directly on the database without using WP functions because WP functions are inadequate for the tasks involved.

  • Would really like to see this as well. Isn’t this just a matter of assigning a unique ID to each custom field and it’s entries? I think you already thought of that, but it would be very nice to see the entries removed when a field is removed. I like to keep the database nice and clean.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘When a field is deleted, also delete previously saved data’ is closed to new replies.