Support

Account

Home Forums ACF PRO ACF form submit fails to create a new WordPress post Reply To: ACF form submit fails to create a new WordPress post

  • Thank you John,

    I have simplified my code to the one below. However, upon form submit the WordPress site crashes. Is there anything wrong with this code?

    <?php
        acf_form_head();
        get_header();
    ?>
    
    <div id="content">
        <div class="wrap">
            <form id='post' class='acf-form' action='' method='post'>
    
                <?php
                    $field_groups = array('group_596925d98777d');
                    acf_form([
                        'field_groups'  => $field_groups,
                        'post_id'       => 'new_post',
                        'new_post'      => array(
                            'post_category' => 'academy',
                            'post_status'   => 'draft',
                            'post_title'    => $post_id,
                         ),                  
                        'post_content'  => false,
                        'form'          => false,
                        'submit_value'  => __("Submit post", 'acf'),
                        'updated_message' => __("Thank you!", 'acf'),
                        'html_updated_message' => '<div id="message" class="updated" style="display:block;"><p>%s</p></div>'
                    ]);
                ?>
    
            </form>
    
        </div>
    </div>
    
    <?php get_footer();