Home › Forums › Backend Issues (wp-admin) › Custom fields get emptied when publishing › Reply To: Custom fields get emptied when publishing
@PerS & @Mathias Gomig – after a considerable amount of searching, I finally figured out that this problem is being caused by the ‘load_field_defaults’ function in ACF’s core/fields/_base.php. The value is being saved and even being loaded without issue, but this function overwrites the value of the field with the default value. I’m not entirely sure why this is happening, but it’s definitely the culprit.
To resolve the situation, simply override this function like so:
function load_field_defaults( $field ) { return $field; }
The field values are now displaying correctly for me on ACF 4.2.0.
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!
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.