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

    • gavin310

    • December 17, 2018 at 10:14 pm

    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.

  • +1

  • 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.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.