Support

Account

Home Forums Front-end Issues Form custom fields not working

Solved

Form custom fields not working

    • Fungie

    • September 15, 2020 at 10:39 pm

    Hi, I have a frontend form that I am using for users to submit posts using acf_form. It has been working fine but after updating to the latest version my form fields don’t show anymore. Below is the warning I’m getting

    Warning: Invalid argument supplied for foreach() in /site_path/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php on line 536

    Please help.

  • What are you supplying for “field_groups” argument when calling acf_form()?

    • Fungie

    • September 16, 2020 at 11:06 pm

    Im supplying the field groups ID as shown below. All ACF fields are not showing on the form.

    <?php
                     acf_form(array(
                         'post_id' => 'new_post',
                         'field_groups' => 7955, // Used ID of the field groups here.
                         'post_title' => true, // This will show the title filed
                         'post_content' => true, // This will show the content field
                         'form' => true,
                         'new_post' => array(
                             'post_type' => 'auto_team',
                             'post_status' => 'publish' // You may use other post statuses like draft, private etc.
                         ),
                         'return' => '%post_url%',
                         'submit_value' => 'Submit Staff',
                     ));
                
            ?>
  • according to the documentation that value must be an array https://www.advancedcustomfields.com/resources/acf_form/

    
    'field_groups' => array(7955), // Used ID of the field groups here.
    

    There may have been code previously to convert non-array values to arrays, but I don’t know. If this was the case the developer probably removed it since the documentation clearly calls for an array here.

    • Fungie

    • September 16, 2020 at 11:27 pm

    Thanks John the array part is what I was missing. For some reason it was working in the previous version of the plugin.

    Its working now I appreciate it

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.