Support

Account

Home Forums Front-end Issues Form custom fields not working

Solved

Form custom fields not working

  • 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()?

  • 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.

  • 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.