Home Forums General Issues ACF frontend form Reply To: ACF frontend form

  • You can only create one post automatically with a front end form, which is the same way that WP works in the back end.

    If I needed to do this I would create and acf/save_post filter that runs after ACF (priority 20) In this filter I would get the information from the post that was saved and duplicate it into the other post type. You might want to see if it was already done and if it’s the right post type.

    Here are some basics

    add_action('acf/save_post', 'duplicated_acf_form_post');
    function duplicated_acf_form_post($post_id) {
      if (is_admin()) {
       // since this is for a front end form
       // return if we're in the admin
      if (get_post_type($post_id) != 'your-custom-post-type') {
        // not what you want to duplicate
      // get post values, or something unique
      // from this post to compare to the other post type posts
      // to see if the duplicate already exists
      // user wp_insert_post() to insert a new post
      // or wp_update_post() to update an existing post