Support

Account

Home Forums Front-end Issues Multiple CPT front-end post issue Reply To: Multiple CPT front-end post issue

  • Can’t create a new topic in the weekends, so a reply might be the best solution.

    Basically I want to know how to make two seperate forms (on two different pages even) on the front end where users can create posts. Form one is used to create posts of the custom post type A. Form two is used to create posts of the custom post type B.

    • I created two forms using the ACF plugin.
    • I created the custom templates for displaying both forms.
    • I added the acf_form_head() to the templates
    • I added the $options for each form on each of the templates and added the acf_form ( $options) like is shown in the tutorial
    • I added the code shown in the tutorial in the functions.php file. One function called cptA_pre_save_post and one function called cptB_pre_save_post. Ofcourse the post_type is set to the right type for each.

    So far so good. But when creating posts from the front end forms they seem to use only the code from one of the functions. Form two also creates a post of post type A instead of B for example. Which probably has something to do with the answer you replied to @rvirvo .

    You say they will never work this way because of the updated $post_id param. My issue, or my question if you will is: could you explain to me how (if possible) to make this work.

    Thanks in advance, and I love your ACF plugin (and add-ons).