Home › Forums › Backend Issues (wp-admin) › WP User frontend pro not saving ACF values to Database › Reply To: WP User frontend pro not saving ACF values to Database
I do not have the plugin you mention so there isn’t any way I can see what that plugin is doing.
At one time ACF would show fields if the same meta_key (i.e. field name) was used. This is no longer the case and it was changed not long ago for security reasons. ACF also requires a field key reference to be saved. The field key reference is recorded in the DB as "_{$field_name)"
. Without this value ACF will not show your field on the front end, but it will find and show the field value in the admin when editing.
The reason that the function you added is not doing anything is because ACF is looking for an array in $_POST[‘acf’] made up of field_key => value pairs. In the case of the other plugin, the form input does not include this array.
The solution is to create a action as suggested but instead of
do_action( 'acf/save_post', $post_id );
you will have to get each of the fields using get_post_meta()
and then update each field using
update_field($field_key, $value, $post_id);
replacing $field_key with the correct field key that corresponds to each field name that you want to update.
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.