Support

Account

Home Forums Front-end Issues Using acf_form for multiple post_type Reply To: Using acf_form for multiple post_type

  • Hi @enricospada

    Thanks for the clarification. For your filter to know which form posted the data, you will need to use the ‘post_id’ parameter.

    If you look at the tutorial here:
    http://www.advancedcustomfields.com/resources/tutorials/using-acf_form-to-create-a-new-post/

    You will see that the filter function contains a check on the $post_id parameter:

    
    // check if this is to be a new post
        if( $post_id != 'new' )
        {
            return $post_id;
        }
    

    This ‘new’ comes from the acf_form $options array and you can customize it!

    Therefore, on form 1, you could set this as ‘new_1’, and on form 2 ‘new_2’, etc.

    Then you can set up 2 functions hooked into the pre_save_post filter and use the validation like so:

    
    // check if this is to be a new post
        if( $post_id != 'new_1' )
        {
            return $post_id;
        }
    

    Hope that helps.

    Thanks
    E