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();
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.