Support

Account

Home Forums General Issues acf_form doesn't save my input

Solved

acf_form doesn't save my input

  • I have created a set of custom fields that go along with a custom post-type.
    I wanted to create a form for posting on the front-end useing the custom fields,but if I try to post something the values of the Custom-fields don’t get saved. The default values of post_title and post_conten does get saved however. I look up a lot of threads in the forum but didnt find a solution.

    I will post the Template with the form I use.

    <?php 
    /*
    Template Name:AFCFormTemplate
    */
    acf_form_head(); 
    get_header(); ?>
    
            <div id="container">
                <div id="content" role="main">
                    <div class="x-container offset-bottom max width">
    
                        <?php  x_get_view( 'global', '_index' ); ?>
                            <?php the_post(); ?>
                                <h1 class="entry-title"><?php the_title(); ?></h1>
                                <div id="content x-container offset-bottom">
    
                                    <?php acf_form(array(
                                'post_id'		=> 'new_post',
                                'post_title'	=> false,     
                                'field_groups' => array('255'),
                                'new_post'		=> array(
                                    'post_type'		=> 'creation',
                                    'post_status'		=> 'publish'
                                ),
                                'submit_value'		=> 'Create a new event'
        
                            )); ?>
    
                                </div>
                    </div>
                </div>
                <!-- #content -->
            </div>
            <!-- #container -->
    
            <?php get_sidebar(); ?>
                <?php get_footer(); ?>
    

    I hope someone can help me. I’m using X-theme just in case someone is wondering.

  • Hi @floriansebt

    I’ve just tested that code on my installation, and it works correctly. Maybe there’s something on your site that prevents the saving process. Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.

    It’s also possible that you have the max_vars variable issue. In this case, could you please try the solution on this page: https://www.advancedcustomfields.com/resources/limit-number-fields/?

    Also, could you please share the JSON or XML export file of your field group so I can check the settings and test it out?

    Thanks 🙂

  • Hi
    At first thanks for helping me.
    You helped me a lot I deactivated all plugins and activated them again and now
    it works thanks for that.
    I think the plugin that was causing error was a plugin I installed before I know you
    can use acf_form for front-end Posting.
    It works now and I’m glad.

    Thanks for the help. 😀

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

The topic ‘acf_form doesn't save my input’ is closed to new replies.