Support

Account

Home Forums General Issues more forms with acf_forms

Helping

more forms with acf_forms

  • Hi

    I am using this to create new custom posts.

    http://www.advancedcustomfields.com/resources/using-acf_form-to-create-a-new-post/

    I have 2 templates with different forms, and creating different custom posts.

    The code below is from functions.php and it needs to be different depending on which form is sent.

    // Create a new post
    $post = array(
        'post_status'  => 'publish' ,
        'post_title'  => $_POST["acf"]['the_field_i_get_post_title_from'] ,
        'post_type'  => 'my custom post type' ,        
    ); 

    I hope this makes sense, I am having a hard time explaining it.

    Best regards
    Sonny

  • Hi @sonnyside,

    Thanks for the post.

    In this use case it is recommended to call the acf_form() function from within each template to create different posts depending on the template.

    Another workaround would be to create a new post_id for the post by hooking into the acf/save_post hook.

    I hope this info helps.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘more forms with acf_forms’ is closed to new replies.