Support

Account

Home Forums ACF PRO Issue with Live edit and ACF pro Reply To: Issue with Live edit and ACF pro

  • Hi @eckul,

    Thanks for the post.

    It would be a lot easier if you could make use of the acf_form() function and pass the flexible content field key to the ‘fields’ argument of the form.

    You will only need to pass the acf_form_head() function at the top of your template to handle the processing of the form data and the acf_form() function within the posts loop.

    To create a new post, the code would look like so:

    <?php acf_form_head(); ?>
    <?php get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    
    			<?php /* The loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php acf_form(array(
    					'post_id'		=> 'new_post',
                                            'fields'                => array('field_key'),
    					'new_post'		=> array(
    						'post_type'		=> 'event',
    						'post_status'		=> 'publish'
    					),
    					'submit_value'		=> 'Create a new event'
    				)); ?>
    
    			<?php endwhile; ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>