I have a field group with 5 custom fields.
Is it possible to display just one field for editing on the front-end via acf_form?
I can’t seem to work out how to only target a single field. I figure I must be missing something as it seems logical I’d be able to target a single field via its name or something similar?
Any help appreciated.
It depends on what version of ACF you are using. If you are using ACF5, then yes, you can include only a single field of a group and it’s in the documentation https://www.advancedcustomfields.com/resources/acf_form/. See the option fields
ACF4 does not have this capability and it cannot be done. You would need to create a field group with only one field to do it in ACF4. https://www.advancedcustomfields.com/resources/acf_form/?version=4
Thanks John,
I am using the pro version now but still unsure how to show only two fields named ‘rating1’ and ‘rating2’ in my front-end form (from a field group with ID of 21). At the moment I am seeing every field. Any thoughts on how I can show ONLY these 2 fields? My code so far…
acf_form(array(
'post_id' => $post_id,
'post_title' => false,
'field_groups' => array(21),
'submit_value' => 'Submit changes'
));
This solves my question.
<?php
acf_form(array(
'post_id' => $post_id,
'post_title' => false,
'field_groups' => array(21),
'fields' => array('rating1','rating2'),
'submit_value' => 'Submit changes'
));
?>
You either need to include the whole field group or both of the fields you want to show. You shouldn’t need to do both.