Home › Forums › General Issues › How to import (wp all import) the custom fields attached to each term using ACF? › Reply To: How to import (wp all import) the custom fields attached to each term using ACF?
Are you using ACF free version? If you are, then you should be able to do it like this:
$fields_list = array();
$fields_posts = array();
$group_posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'acf',
));
foreach($group_posts as $group_post){
$fields = array();
$fields = apply_filters('acf/field_group/get_fields', $fields, $group_post->ID);
$fields_posts = array_merge($fields_posts, $fields);
}
foreach($fields_posts as $fields_post){
$fields_list[$fields_post['name']] = $fields_post['key'];
}
print_r($fields_list);
Could you please test it?
Thanks 🙂
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.