Home › Forums › General Issues › acf/save_post not working with calculated update_field › Reply To: acf/save_post not working with calculated update_field
Is the first option a more manual version of the second one, I didn’t quite follow where you were going with it.
As for the second one, it is very close to what I had, but with some better checks and using acf_get_fields, instead of get_fields. What is the reasoning behind this, won’t get fields work just as well?
I have 4 acf groups and I include them in acf_form from the beginning:
/* Create Front-End Form */
global $current_user; //get current logged in user info
$author_id = $current_user->ID; //pull user id and assign to author_id variable
//form/post options
$args = array(
'post_id' => 'new_post', //creates new post instead of editing
'field_groups' => array(79,359,1877,1966), //proposal field group
'return' => '%post_url%', // redirect to new post url
'new_post' => array( //option for new post
'post_type' => 'proposals', //creates a new post in "Proposals" CPT
'post_status' => 'draft', //
'post_author' => $author_id //assigns author as the person logged in
),
'submit_value' => 'Create Proposal'
);
//loads the ACF fields with above settings
acf_form( $args );
I tried the second option, but I got the same outcome. All of the fields populate on creation except for the calculations, since they can’t get the values for the other fields.
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.
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.