A recent project included the requirement to allow users of the site to be able to submit a form that populated a custom post on the WordPress back-end.

While there are several plugins that enable you to do this, there’s an even simpler way if you’re a user of Advanced Custom Fields Pro: the acf_form() function.

Check out how we’ve used it below:

<?php
acf_form(array(
	'post_id'		=> 'new_post',
	'submit_value' => __("Submit Event", 'acf'),
	'post_title'	=> true,
	'updated_message' => __("Thank you for your submission!", 'acf'),
	'post_content'	=> true,
	'new_post'		=> array(
		'post_type'		=> 'event',
		'post_status'	=> 'draft'
	)
));
?>