Home › Forums › Backend Issues (wp-admin) › Can I safely delete the field references in post_meta? › Reply To: Can I safely delete the field references in post_meta?
The answer is no. Without the field key reference not only does ACF not know what type of field it is but ACF will not return the field if the field key reference in the DB is missing when using one of the ACF template functions. The latter part was added for security to prevent the use of fields created outside of ACF.
The issue and reason that the field key reference is needed is do to the simplicity of the WP meta tables. There are only 3 usable columns: post_id, meta_key, meta_value. There simply isn’t a way to relate a field to this data without the additional value.
This is also due to the fact that field names do not need to be unique. You could easily have two fields used on two different post types that are different types of fields with the same name. But the field key is always unique. ACF uses a combination of the post ID and the field name to get the field key reference used for the specific field name used on the specific post.
It is possible to bypass the use of the field key reference by using the field key in ACF template functions instead of the field name. Using the field name is provided as a convenience to developers to make it easier for coding and for code clarity. It is easier to use something like “background_color” and it is easier to see what that field is for instead of something like “field_XXXXXXX”.
use some more smart way to find the field type
ACF was built to work with what is provided by WP, it is basically a big wrapper for all of the meta and option functions in WP and does nothing that could not be accomplished without it. What ACF does is that it makes the building out of complex admin UIs simple and fast saving the developer the need to code it all themselves. You can even replace all of the ACF template function calls with native WP function calls, provided you also want to do all of the field value formatting yourself.
I’m sure that if anyone came up with something simpler that also worked within what is provided natively in WP that the developers would love to hear about it.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!