Support

Account

Home Forums Front-end Issues How Update a post in front-end with acf (acf_form) Reply To: How Update a post in front-end with acf (acf_form)

  • In the acf_form() call you need to provide the post ID of the post that needs to be edited.

    
    if (some condition) {
      // the if needs to detect if a post is being edited
      // if it is then set $post_id to the post to be edited
      $post_id = $post=>ID; // something like this
    } else {
      // otherwise this is a new post
      $post_id = 'new_post';
    }
    
    acf_form(array(
         'post_id'		=> $post_id,
         'field_groups'	=> array( 19250 ),
         'post_title'	=> false,
         'updated_message' => __("Post updated", 'acf'),
         'submit_value'	=> 'Send',
         'return' => ''
      ));