Support

Home Forums Event Espresso Premium Duplicate ACF Repeater field

Duplicate ACF Repeater field

Posted: April 11, 2018 at 1:56 am


Kursus-Kompagniet.dk

April 11, 2018 at 1:56 am

Hi, i’m trying to duplicate an event, and get the data from ACF fields duplicated. I found some topics on this, which works great. My problem is, that repeater fields does not get duplicated. Can someone help me solve this?

I have used this: https://eventespresso.com/topic/hooking-into-the-private-function-_duplicate_event/

To generate this code: https://pastebin.com/3AeqpczK

How can i get the info from repeaterfields duplicated?


Tony

  • Support Staff

April 12, 2018 at 5:49 am

Hi there

ACF repeater fields are stored differently, so you can’t just pull the value and then update it on the new event like you are currently.

You can try something like this:

//Set the repeater field name here.
$field_name = 'testing_repeater';

//Pull the field object as you need the key for update_field()
$field = get_field_object($field_name, $orig_event->ID());
$field_key = $field['key'];

//Pull all of the reater values from the original event
$rows = get_field($field_name, $orig_event->ID());

//'Update' the repeater field on the new event.
update_field($field_key, $rows, $new_event->ID());

If that doesn’t work you’ll need to contact ACF to see how you need to pull the values and update a new post.


Kursus-Kompagniet.dk

April 16, 2018 at 5:32 am

Works like a charm! Thank you very much, for the sublime support.


Tony

  • Support Staff

April 16, 2018 at 8:34 am

You’re most welcome 🙂

If have a minute we would really appreciate if you could share your experience with Event Espresso or provide a review on WP.org.

The support post ‘Duplicate ACF Repeater field’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 6 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!