Home › Forums › Front-end Issues › 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
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.