Create a front end form


This article will cover how to create a form on the front end of your website to add or edit content. Two functions are available to create a working form in a template file.

Name Description
acf_form_head() This function is placed at the top of a template file and will register the necessary assets (CSS/JS), process the saved data, and redirect the url. This function does not accepts any parameters
acf_form() This function is placed within a template file and will create the form’s HTML. This function accepts an array or settings to customize the form in many ways


This example shows how to add a front end form to a single post page. This would allow a user to edit the current post’s content


<?php acf_form_head(); ?>
<?php get_header(); ?>

	<div id="primary">
		<div id="content" role="main">

			<?php /* The loop */ ?>
			<?php while ( have_posts() ) : the_post(); ?>
				<h1><?php the_title(); ?></h1>
				<?php the_content(); ?>
				<p>My custom field: <?php the_field('my_custom_field'); ?></p>
				<?php acf_form(); ?>

			<?php endwhile; ?>

		</div><!-- #content -->
	</div><!-- #primary -->

<?php get_footer(); ?>


The acf_form() function accepts an array of settings to customize the form element. Such settings include the ability to create a new post, edit a specific post, select which field groups to show, and customize HTML elements. Please read the complete acf_form() documentation to learn more about available settings.