Support

Account

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?

  • Hi @sunilkushwaha01

    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 🙂