Support

Account

Home Forums ACF PRO acf_form() Creates duplicate posts

Solved

acf_form() Creates duplicate posts

  • Hello

    1.
    When the client saves a post through the form generated by the function “acf_form()” the acf saves two equal posts, does anyone know how to resolve this?

    follow code:

    <?php /* Template Name: Publicar RELPREV */ ?>
    <?php 
    acf_form_head();
    get_header(); 
    include(dirname(__DIR__).'/googleFrontEnd.php');
    ?>
    
    	<div id="primary" class="content-area">
            <main id="main" class="site-main" role="main">
    
                <?php 
                acf_form(array(
                    'post_id' => 'new_post',
                    'new_post' => array(
                        'post_type'	=> 'relprev',
                        'post_status' => 'publish'
                    ),
                    'post_title'=> true,
                    'fields' => array(
                        'data_e_hora',
                        'autor_do_relato',
                        'e-mail_do_autor_do_relato',
                        'telefone_do_autor_do_relato',
                        'local',
                        'empresas_envolvidas',
                        'aeronaves_envolvidas',
                        'veiculosequipamentos_envolvidos',
                        'perigo_observado'
                    ),
                    'return' => '%post_url%',
                    'submit_value' => 'Enviar Relato'
                )); 
                ?>
    
    		</main><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_footer(); ?>

    2.
    I would also like to ask if the dateTime fields can be displayed with a picker as it happens in the register by the administration page.

  • The dateTime problem was solved, it was the ‘Fast Velocity Minify’ plugin that was in trouble. We only get the problem of the post being saved in duplicity

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘acf_form() Creates duplicate posts’ is closed to new replies.