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.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users