Home › Forums › Front-end Issues › Load fields in front end form
Please, help, how to dynamically load fields in front end form (or update front-end form)?…

Hi @trasyhoob
Your question is to vague for me to answer correctly.
Can you please elaborate?
Thanks
E
Hello, I have a number of taxonomies, frond end ACF form and html-select of this taxonomies. I want to load group of fields which match selected taxonomy dynamically… (via ajax)… how i can do this…?

Hi @trasyhoob
Just to clarify, are you saying:
You have a front end form for editing a post. When you select a taxonomy value for this post, you would like ACF to load in any new field groups which now match (like in the wp-admin)?
I’m trying to do something similar I think. I need to insert a new post on the frontend. I’m doing something like the following:
acf_form(array(
'post_id'=> 'new',
'field_groups'=>array(123, $AllFieldgroupsAssignedToThisPostType)
);
How can I get the field_groups assigned to the post type?

Hi @wullaski
This is possible by running the ACF location rule match functionality based on the current screen.
something like this should work:
<?php
// get field groups
$filter = array(
'post_type' => 'post',
'post_id' => 0
);
$field_groups = array();
$options['field_groups'] = apply_filters( 'acf/location/match_field_groups', $field_groups, $filter );
?>
Note: this is based of the api.php -> acf_form function and has not been tested
The topic ‘Load fields in front end form’ is closed to new replies.
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.