Support

Account

Forum Replies Created

  • Thanks so much for you detailed reply!

    I have found the hook finally. I added do_action( 'acf/save_post', $post_id ); after $post_id = wp_insert_post( $new_post ); and the fields can be updated in once.

    However, another issue still haven’t be solved. When I’m trying to submit another new form, the previous entries shows again. Do you have any idea how can I solve this? I found that the existing form sets the post_id = 0 before generating a new post ID.

  • I have come up with a thought.

    The ACF fields keep showing the previous entries because the existing form don’t have a post id yet until users submitted the form. Therefore, the form needs to save twice in order to get the data from ACF.

    If this is the case, is there any way ACF can solve it?

  • The existing frontend form is for the members to submit a new post in website. As the post is about is discount or coupon details, I wanna use ACF to add few more fields to the existing form, which are deals start date, end date and coupon code.

    Do you mean the existing form may not allow ACF to function well?

    Didn’t know if this information useful, I tried to add a field of tag by ACF in the function.php, and it works. Does it mean ACF is able to function in the form?

    
    $submission_data = array(
    'id'			=> $post_id,
    'title'         	=> $title,
    'source'        	=> $source,
    'ref_link'        	=> $ref_link,
    'description'   	=> $description,
    'category_id'   	=> $categories,
    'tags'          	=> $_POST['acf']['field_6023f52f7b6f0'],
    'list_voting'       => $list_voting,
    'list_submission'	=> $list_submission,
    'author'		=> $author_id,
    'status'		=> $status,
    );
    
    do_action( 'snax_handle_'. $format .'_submission', $submission_data, $request ); 
    
  • Thank you for the reply.

    1 & 2) yes, I did both.

    3) I did it because the fields couldn’t update automatically after submission. After I submitted the form, only the data from existing form was being updated.

    I have also tried to add 'post_id' => 'new_post' in acf_form(), the data can be updated immediately, but two posts were being created.

Viewing 4 posts - 1 through 4 (of 4 total)