Support

Account

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

  • Hi @florushj

    The issue here is that bother forms (created with the acf_form function) will trigger the same ‘acf/pre_save_post’ filter.

    To allow for multiple pre_save_post filters and multiple forms, you need to find a way to connect the form to the correct filter! This can be done by customizing the ‘post_id’ param in the form.

    Current you are using ‘new’ for the post_id, correct? If you canged that to ‘new_cpt_a’ on one form, and ‘new_cpt_b’ on another form, then you can run the correct filter like so:

    
    // within filter 1
    // check if this is to be a new post
        if( $post_id != 'new_cpt_a' )
        {
            return $post_id;
        }
    
    
    // within filter 2
    // check if this is to be a new post
        if( $post_id != 'new_cpt_b' )
        {
            return $post_id;
        }
    

    Hope that helps

    Thanks
    E