Support

Account

Home Forums Front-end Issues acf_add_local_field_group and using frontend form doesn't work

Helping

acf_add_local_field_group and using frontend form doesn't work

  • I am having an issue with advanced Custom Fields acf_add_local_field_group it works all fine in the admin, however, if I use this with acf_form no fields display I have used the key for field_groups and tried to place fields in the form args.

    I have printed my groups and the one I have programmatically created is not there, would this stop acf_form from working? Any help would be appreciated.

  • Actually, I did work this was being silly I didn’t add the fields I needed to the argument. I looped through my created fields and added the keys into the form

    $fields = new HAELCP_Subscriptions_Acf($this->plugin);
    				$get_fields = $fields->register_fields($subscription->get_id());
    
    				if ($get_fields){
    					$fields_to_get = array();
    					foreach ($get_fields['fields'] as $key => $field){
    							$fields_to_get[] = $field['key'];
    					}
    				
    				}
    				acf_form(array(
    					'post_id'	=> $subscription->get_id(),
    					'field_groups' => array($subscription->get_id()),
    					'fields' => $fields_to_get
    				));
Viewing 2 posts - 1 through 2 (of 2 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.