# Adding fields from the ACF plugin to the add and edit ad form on the frontend

**URL:** <https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658>\
**Category:** HivePress\
**Created:** [April 22, 2025, 4:39pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658 "2025-04-22T16:39:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![alivgon](https://community.hivepress.io/user_avatar/community.hivepress.io/alivgon/32/3273_2.png) [@alivgon](https://community.hivepress.io/u/alivgon)\
**Post date:** [April 22, 2025, 4:39pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/1 "2025-04-22T16:39:45Z")

</div>

Hello!  
I created a field group Repeater in the ACF plugin with the name hp\_listing\_master.  
And the fields in this group Gallery with the name hp\_listing\_galereya and Text area with the name hp\_listing\_opisanie.  
In the Location rules, I specified the Record type - equals - Advertisement. As a result, this field group is displayed in the admin panel, when adding a new advertisement and editing an advertisement.  
But this field group is not displayed when adding a new advertisement and editing an advertisement on the frontend.  
Tell me how to fix this error?  
Thank you!

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [April 24, 2025, 9:09pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/4 "2025-04-24T21:09:08Z")

</div>

Hi,

Our Forms API is not based on ACF and unfortunately there are no equal field types for ACF’s Gallery and Repeater. We have a Repeater field type, but in the current version it requires configuration via a code snippet, I can provide a sample snippet if needed.

---

<div class="post-metadata">

**Author:** ![alivgon](https://community.hivepress.io/user_avatar/community.hivepress.io/alivgon/32/3273_2.png) [@alivgon](https://community.hivepress.io/u/alivgon)\
**Post date:** [April 24, 2025, 9:41pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/5 "2025-04-24T21:41:59Z")

</div>

Hi, [ihor](https://community.hivepress.io/u/ihor)

Yes, please tell me what I should start from.

Provide a code snippet example. And any other hint so I can implement this.  
Thanks!

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [April 25, 2025, 10:51am UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/7 "2025-04-25T10:51:30Z")

</div>

Please try using this sample code snippet [A working sample of a repeater? - #4 by ihor](https://community.hivepress.io/t/a-working-sample-of-a-repeater/14201/4) It adds the Repeater field to both back-end and front-end forms, handles validation and saving values.

---

<div class="post-metadata">

**Author:** ![alivgon](https://community.hivepress.io/user_avatar/community.hivepress.io/alivgon/32/3273_2.png) [@alivgon](https://community.hivepress.io/u/alivgon)\
**Post date:** [April 25, 2025, 2:49pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/8 "2025-04-25T14:49:43Z")

</div>

Thanks, [ihor](https://community.hivepress.io/u/ihor). I’ve seen this code before and applied it to text fields.  
But I need to add a “Repeater” field to forms with images.

---

<div class="post-metadata">

**Author:** ![condorito.fr](https://community.hivepress.io/user_avatar/community.hivepress.io/condorito.fr/32/11449_2.png) [@condorito.fr](https://community.hivepress.io/u/condorito.fr)\
**Post date:** [April 25, 2025, 3:51pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/9 "2025-04-25T15:51:16Z")

</div>

Did it occur to you to replace text by image (or images) ?

---

<div class="post-metadata">

**Author:** ![alivgon](https://community.hivepress.io/user_avatar/community.hivepress.io/alivgon/32/3273_2.png) [@alivgon](https://community.hivepress.io/u/alivgon)\
**Post date:** [April 25, 2025, 4:47pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/10 "2025-04-25T16:47:04Z")

</div>

I tried, but the image upload field doesn’t show up.

It doesn’t work.

```auto
add_filter('hivepress/v1/models/listing/attributes', function($attributes) {
    $attributes['masters'] = [
        'editable' => true,
        'edit_field' => [
            'type' => 'repeater',
            'label' => 'Мастера',
            '_order' => 1000,
            'button_caption' => '<span>Добавить мастера</span>',
            'fields' => [
                'masters__images' => [
                    'type' => 'attachment',
                    'label' => 'Изображение услуги',
                    'multiple' => true,
                    'max_files' => 10,
                    'formats' => ['jpg', 'jpeg', 'png'],
                    '_model' => 'attachment',
                ],
                'masters_price' => [
                    'type' => 'number',
                    'label' => 'Стоимость',
                    'placeholder' => 'Стоимость',
                    'min_value' => 0,
                    'suffix' => '₽',
                ],
                'masters_description' => [
                    'type' => 'textarea',
                    'label' => 'Описание',
                    'placeholder' => 'Краткое описание (максимум 50 символов)',
                    'max_length' => 50, // Жесткое ограничение символов
                    'rows' => 3, // Высота поля ввода

                ],
            ],
        ],
    ];
    return $attributes;
});

```

So the image upload field is added, but when you upload images, they are not saved. And the repeater does not work

```auto
add_filter('hivepress/v1/models/listing/attributes', function($attributes) {
    $attributes['masters'] = [
        'editable' => true,
        'edit_field' => [
            'type' => 'repeater',
            'label' => 'Мастера',
            '_order' => 1000,
            'button_caption' => '<span>Добавить мастера</span>',
            'fields' => [
                'masters__images' => [
                    'type' => 'attachment_upload',
                    'label' => 'Изображение услуги',
                    'multiple' => true,
                    'max_files' => 10,
                    'formats' => ['jpg', 'jpeg', 'png'],
                    '_model' => 'attachment',
                ],
                'masters_price' => [
                    'type' => 'number',
                    'label' => 'Стоимость',
                    'placeholder' => 'Стоимость',
                    'min_value' => 0,
                    'suffix' => '₽',
                ],
                'masters_description' => [
                    'type' => 'textarea',
                    'label' => 'Описание',
                    'placeholder' => 'Краткое описание (максимум 50 символов)',
                    'max_length' => 50, // Жесткое ограничение символов
                    'rows' => 3, // Высота поля ввода

                ],
            ],
        ],
    ];
    return $attributes;
});

```

So the image upload field is not displayed

```auto
add_filter('hivepress/v1/models/listing/attributes', function($attributes) {
    $attributes['masters'] = [
        'editable' => true,
        'edit_field' => [
            'type' => 'repeater',
            'label' => 'Мастера',
            '_order' => 1000,
            'button_caption' => '<span>Добавить мастера</span>',
            'fields' => [
                'masters__images' => [
                    'type' => 'image',
                    'label' => 'Изображение услуги',
                    'formats' => ['jpg', 'jpeg', 'png'],
                ],
                'masters_price' => [
                    'type' => 'number',
                    'label' => 'Стоимость',
                    'placeholder' => 'Стоимость',
                    'min_value' => 0,
                    'suffix' => '₽',
                ],
                'masters_description' => [
                    'type' => 'textarea',
                    'label' => 'Описание',
                    'placeholder' => 'Краткое описание (максимум 50 символов)',
                    'max_length' => 50, // Жесткое ограничение символов
                    'rows' => 3, // Высота поля ввода

                ],
            ],
        ],
    ];
    return $attributes;
});

```

Please correct me if I am wrong and there are errors in my code.

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [April 28, 2025, 4:43pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/12 "2025-04-28T16:43:21Z")

</div>

Unfortunately there’s no easy way to nest the Attachment field inside the Repeater field in the current framework version, this would require a custom implementation. You can try using the attachment field without the “multiple” flag, but if I remember correctly the field type itself is not supported for nesting in repeatable elements.

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [May 28, 2025, 4:43pm UTC](https://community.hivepress.io/t/adding-fields-from-the-acf-plugin-to-the-add-and-edit-ad-form-on-the-frontend/15658/13 "2025-05-28T16:43:37Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
