I don’t know why, but since I’m using ACF Pro, this worked:
acf_update_setting('enqueue_google_maps', false );
I have Google Maps working now in my code.
Not working (even with the fixed typo).
Google Maps code still being loaded by ACF.
Does anyone know of an internal function to load the values from a post into a form?
Is there an option to use the Basic uploader instead of the WP Image Uploader?
ps. The Javascript documentation is pretty sparse.
After a LOT of poking around, I found that ACF does not make ajax calls for non dynamic fields when adding new repeater fields.
The “acf” JavaScript object got me where I needed to be:
acf.addAction("new_field/key=field_5c3f4147608c4", function( field ) {
//mycode
});
Okay, one problem fixed by changing to the acf/prepare_field/key={key}
filter.
Next problem, it’s only called ONCE when the form is loaded.
I am trying to add a readonly timestamp field to each repeater value, but it’s using the timestamp of the form load. I need it to be realtime.
debug_backtrace() was my friend… Figured it out.
Hmm, I spun up a blank site and acf/save_post is only called once.
So, how do I track down the other culprits?
Thanks… why does this forum for feature requests exist, then?
Okay, I ended up writing some code that uses get_field_object() to build me a nested array tree that I can use to store data. The tree I built by hand had several mistakes in it because of how complex/convoluted it is.
Now it’s working.
I have to say that I am EXTREMELY disappointed in how ACF stores data and the extraordinary lengths I have to go through in order to work with complex forms. For non developers, ACF really is great, but for developers working on complex projects, it’s a nightmare.
It’s repeaters nested inside of a group… Very complex:
Array
(
[ID] => 10198
[key] => field_5b21445c02e41
[label] => Event Date
[name] => event_date
[prefix] => acf
[type] => group
[value] => Array
(
[event_date_type] => date
[event_single_day] => Array
(
[0] => Array
(
[event_date] => 20181219
[event_time] => Array
(
[0] => Array
(
[event_start_time] => 10:00:00
[event_end_time] => 10:30:00
)
[1] => Array
(
[event_start_time] => 10:30:00
[event_end_time] => 11:00:00
)
)
)
)
[event_date_range] =>
[event_recurring_weekly] => Array
(
[event_start_date] =>
[event_end_date] =>
[event_time] =>
[event_recurring_days] => Array
(
)
)
[event_recurring_monthly] =>
)
[menu_order] => 8
[instructions] =>
[required] => 1
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 15
[wrapper] => Array
(
[width] =>
[class] =>
[id] =>
)
[_name] => event_date
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[layout] => block
[sub_fields] => Array
(
[0] => Array
(
[ID] => 10199
[key] => field_5b21449202e42
[label] => Type
[name] => event_date_type
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 0
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10198
[wrapper] => Array
(
[width] => 25
[class] =>
[id] =>
)
[_name] => event_date_type
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[date] => Single Day Event
[range] => Date Range
[weekly] => Recurring Weekly
[monthly] => Recurring Monthly
)
[default_value] => Array
(
[0] => date
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[return_format] => value
[ajax] => 0
[placeholder] =>
)
[1] => Array
(
[ID] => 10200
[key] => field_5b2145b902e43
[label] => Single Day Event
[name] => event_single_day
[prefix] => acf
[type] => repeater
[value] =>
[menu_order] => 1
[instructions] => Events that occur on a single day. You may add multiple dates and times, but each date/time is distinct and will have separate registrations, if registration is required.
[required] => 0
[id] =>
[class] =>
[conditional_logic] => Array
(
[0] => Array
(
[0] => Array
(
[field] => field_5b21449202e42
[operator] => ==
[value] => date
)
)
)
[parent] => 10198
[wrapper] => Array
(
[width] =>
[class] =>
[id] =>
)
[_name] => event_single_day
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[collapsed] => field_5b21463202e44
[min] => 1
[max] => 0
[layout] => block
[button_label] => Add Another Date
[sub_fields] => Array
(
[0] => Array
(
[ID] => 10201
[key] => field_5b21463202e44
[label] => Date
[name] => event_date
[prefix] => acf
[type] => date_picker
[value] =>
[menu_order] => 0
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10200
[wrapper] => Array
(
[width] => 20
[class] =>
[id] =>
)
[_name] => event_date
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[display_format] => m/d/Y
[return_format] => Ymd
[first_day] => 0
)
[1] => Array
(
[ID] => 10202
[key] => field_5b2146c83d961
[label] => Time
[name] => event_time
[prefix] => acf
[type] => repeater
[value] =>
[menu_order] => 1
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10200
[wrapper] => Array
(
[width] => 79
[class] =>
[id] =>
)
[_name] => event_time
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[collapsed] =>
[min] => 1
[max] => 0
[layout] => table
[button_label] => Add Time
[sub_fields] => Array
(
[0] => Array
(
[ID] => 10203
[key] => field_5b2147733d964
[label] => Start Time
[name] => event_start_time
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 0
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10202
[wrapper] => Array
(
[width] => 49
[class] =>
[id] =>
)
[_name] => event_start_time
[_prepare] => 0
[_valid] => 1
[choices] => Array
(
[06:00:00] => 6:00am
[06:15:00] => 6:15am
[06:30:00] => 6:30am
[06:45:00] => 6:45am
[07:00:00] => 7:00am
[07:15:00] => 7:15am
[07:30:00] => 7:30am
[07:45:00] => 7:45am
[08:00:00] => 8:00am
[08:15:00] => 8:15am
[08:30:00] => 8:30am
[08:45:00] => 8:45am
[09:00:00] => 9:00am
[09:15:00] => 9:15am
[09:30:00] => 9:30am
[09:45:00] => 9:45am
[10:00:00] => 10:00am
[10:15:00] => 10:15am
[10:30:00] => 10:30am
[10:45:00] => 10:45am
[11:00:00] => 11:00am
[11:15:00] => 11:15am
[11:30:00] => 11:30am
[11:45:00] => 11:45am
[12:00:00] => 12:00pm
[12:15:00] => 12:15pm
[12:30:00] => 12:30pm
[12:45:00] => 12:45pm
[13:00:00] => 1:00pm
[13:15:00] => 1:15pm
[13:30:00] => 1:30pm
[13:45:00] => 1:45pm
[14:00:00] => 2:00pm
[14:15:00] => 2:15pm
[14:30:00] => 2:30pm
[14:45:00] => 2:45pm
[15:00:00] => 3:00pm
[15:15:00] => 3:15pm
[15:30:00] => 3:30pm
[15:45:00] => 3:45pm
[16:00:00] => 4:00pm
[16:15:00] => 4:15pm
[16:30:00] => 4:30pm
[16:45:00] => 4:45pm
[17:00:00] => 5:00pm
[17:15:00] => 5:15pm
[17:30:00] => 5:30pm
[17:45:00] => 5:45pm
[18:00:00] => 6:00pm
[18:15:00] => 6:15pm
[18:30:00] => 6:30pm
[18:45:00] => 6:45pm
[19:00:00] => 7:00pm
[19:15:00] => 7:15pm
[19:30:00] => 7:30pm
[19:45:00] => 7:45pm
[20:00:00] => 8:00pm
[20:15:00] => 8:15pm
[20:30:00] => 8:30pm
[20:45:00] => 8:45pm
[21:00:00] => 9:00pm
[21:15:00] => 9:15pm
[21:30:00] => 9:30pm
[21:45:00] => 9:45pm
[22:00:00] => 10:00pm
[22:15:00] => 10:15pm
[22:30:00] => 10:30pm
[22:45:00] => 10:45pm
[23:00:00] => 11:00pm
[23:15:00] => 11:15pm
[23:30:00] => 11:30pm
[23:45:00] => 11:45pm
[00:00:00] => 12:00am
)
[default_value] => Array
(
[0] => 07:00:00
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[return_format] => value
[ajax] => 0
[placeholder] =>
)
[1] => Array
(
[ID] => 10204
[key] => field_5b2147af3d965
[label] => End Time
[name] => event_end_time
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 1
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10202
[wrapper] => Array
(
[width] => 50
[class] =>
[id] =>
)
[_name] => event_end_time
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[06:00:00] => 6:00am
[06:15:00] => 6:15am
[06:30:00] => 6:30am
[06:45:00] => 6:45am
[07:00:00] => 7:00am
[07:15:00] => 7:15am
[07:30:00] => 7:30am
[07:45:00] => 7:45am
[08:00:00] => 8:00am
[08:15:00] => 8:15am
[08:30:00] => 8:30am
[08:45:00] => 8:45am
[09:00:00] => 9:00am
[09:15:00] => 9:15am
[09:30:00] => 9:30am
[09:45:00] => 9:45am
[10:00:00] => 10:00am
[10:15:00] => 10:15am
[10:30:00] => 10:30am
[10:45:00] => 10:45am
[11:00:00] => 11:00am
[11:15:00] => 11:15am
[11:30:00] => 11:30am
[11:45:00] => 11:45am
[12:00:00] => 12:00pm
[12:15:00] => 12:15pm
[12:30:00] => 12:30pm
[12:45:00] => 12:45pm
[13:00:00] => 1:00pm
[13:15:00] => 1:15pm
[13:30:00] => 1:30pm
[13:45:00] => 1:45pm
[14:00:00] => 2:00pm
[14:15:00] => 2:15pm
[14:30:00] => 2:30pm
[14:45:00] => 2:45pm
[15:00:00] => 3:00pm
[15:15:00] => 3:15pm
[15:30:00] => 3:30pm
[15:45:00] => 3:45pm
[16:00:00] => 4:00pm
[16:15:00] => 4:15pm
[16:30:00] => 4:30pm
[16:45:00] => 4:45pm
[17:00:00] => 5:00pm
[17:15:00] => 5:15pm
[17:30:00] => 5:30pm
[17:45:00] => 5:45pm
[18:00:00] => 6:00pm
[18:15:00] => 6:15pm
[18:30:00] => 6:30pm
[18:45:00] => 6:45pm
[19:00:00] => 7:00pm
[19:15:00] => 7:15pm
[19:30:00] => 7:30pm
[19:45:00] => 7:45pm
[20:00:00] => 8:00pm
[20:15:00] => 8:15pm
[20:30:00] => 8:30pm
[20:45:00] => 8:45pm
[21:00:00] => 9:00pm
[21:15:00] => 9:15pm
[21:30:00] => 9:30pm
[21:45:00] => 9:45pm
[22:00:00] => 10:00pm
[22:15:00] => 10:15pm
[22:30:00] => 10:30pm
[22:45:00] => 10:45pm
[23:00:00] => 11:00pm
[23:15:00] => 11:15pm
[23:30:00] => 11:30pm
[23:45:00] => 11:45pm
[00:00:00] => 12:00am
)
[default_value] => Array
(
[0] => 08:00:00
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[return_format] => value
[ajax] => 0
[placeholder] =>
)
)
)
)
)
[2] => Array
(
[ID] => 10214
[key] => field_5b2155730460b
[label] => Date Range
[name] => event_date_range
[prefix] => acf
[type] => repeater
[value] =>
[menu_order] => 2
[instructions] => Events that occur over a range of multiple dates with no time specified. You can add multiple date ranges.
[required] => 0
[id] =>
[class] =>
[conditional_logic] => Array
(
[0] => Array
(
[0] => Array
(
[field] => field_5b21449202e42
[operator] => ==
[value] => range
)
)
)
[parent] => 10198
[wrapper] => Array
(
[width] =>
[class] =>
[id] =>
)
[_name] => event_date_range
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[collapsed] =>
[min] => 1
[max] => 0
[layout] => block
[button_label] => Add New Date Range
[sub_fields] => Array
(
[0] => Array
(
[ID] => 10215
[key] => field_5b2155e50460c
[label] => Start Date
[name] => event_start_date
[prefix] => acf
[type] => date_picker
[value] =>
[menu_order] => 0
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10214
[wrapper] => Array
(
[width] => 20
[class] =>
[id] =>
)
[_name] => event_start_date
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[display_format] => m/d/Y
[return_format] => Ymd
[first_day] => 0
)
[1] => Array
(
[ID] => 10216
[key] => field_5b2156130460d
[label] => End Date
[name] => event_end_date
[prefix] => acf
[type] => date_picker
[value] =>
[menu_order] => 1
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10214
[wrapper] => Array
(
[width] => 20
[class] =>
[id] =>
)
[_name] => event_end_date
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[display_format] => m/d/Y
[return_format] => Ymd
[first_day] => 0
)
)
)
[3] => Array
(
[ID] => 10221
[key] => field_5b215748a5c71
[label] => Recurring Weekly
[name] => event_recurring_weekly
[prefix] => acf
[type] => group
[value] =>
[menu_order] => 3
[instructions] => Select the days of the week the event will reoccur. Ex: Selecting Thursday will create the event EVERY Thursday. You can select multiple days of the week.
[required] => 0
[id] =>
[class] =>
[conditional_logic] => Array
(
[0] => Array
(
[0] => Array
(
[field] => field_5b21449202e42
[operator] => ==
[value] => weekly
)
)
)
[parent] => 10198
[wrapper] => Array
(
[width] =>
[class] =>
[id] =>
)
[_name] => event_recurring_weekly
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[layout] => block
[sub_fields] => Array
(
[0] => Array
(
[ID] => 10223
[key] => field_5b21585026e20
[label] => Start Date
[name] => event_start_date
[prefix] => acf
[type] => date_picker
[value] => 12/19/2018
[menu_order] => 0
[instructions] => Date the event will start recurring.
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10221
[wrapper] => Array
(
[width] => 20
[class] =>
[id] =>
)
[_name] => event_start_date
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[display_format] => m/d/Y
[return_format] => Ymd
[first_day] => 0
)
[1] => Array
(
[ID] => 10224
[key] => field_5b21587526e21
[label] => End Date
[name] => event_end_date
[prefix] => acf
[type] => date_picker
[value] =>
[menu_order] => 1
[instructions] => Leave blank for no end date.
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10221
[wrapper] => Array
(
[width] => 20
[class] =>
[id] =>
)
[_name] => event_end_date
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[display_format] => m/d/Y
[return_format] => Ymd
[first_day] => 0
)
[2] => Array
(
[ID] => 10249
[key] => field_5b2168d4f6092
[label] => Time
[name] => event_time
[prefix] => acf
[type] => repeater
[value] =>
[menu_order] => 2
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10221
[wrapper] => Array
(
[width] => 49
[class] =>
[id] =>
)
[_name] => event_time
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[collapsed] =>
[min] => 1
[max] => 0
[layout] => table
[button_label] => Add Time
[sub_fields] => Array
(
[0] => Array
(
[ID] => 10250
[key] => field_5b2168fff6093
[label] => Start Time
[name] => event_start_time
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 0
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10249
[wrapper] => Array
(
[width] => 33
[class] =>
[id] =>
)
[_name] => event_start_time
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[06:00:00] => 6:00am
[06:15:00] => 6:15am
[06:30:00] => 6:30am
[06:45:00] => 6:45am
[07:00:00] => 7:00am
[07:15:00] => 7:15am
[07:30:00] => 7:30am
[07:45:00] => 7:45am
[08:00:00] => 8:00am
[08:15:00] => 8:15am
[08:30:00] => 8:30am
[08:45:00] => 8:45am
[09:00:00] => 9:00am
[09:15:00] => 9:15am
[09:30:00] => 9:30am
[09:45:00] => 9:45am
[10:00:00] => 10:00am
[10:15:00] => 10:15am
[10:30:00] => 10:30am
[10:45:00] => 10:45am
[11:00:00] => 11:00am
[11:15:00] => 11:15am
[11:30:00] => 11:30am
[11:45:00] => 11:45am
[12:00:00] => 12:00pm
[12:15:00] => 12:15pm
[12:30:00] => 12:30pm
[12:45:00] => 12:45pm
[13:00:00] => 1:00pm
[13:15:00] => 1:15pm
[13:30:00] => 1:30pm
[13:45:00] => 1:45pm
[14:00:00] => 2:00pm
[14:15:00] => 2:15pm
[14:30:00] => 2:30pm
[14:45:00] => 2:45pm
[15:00:00] => 3:00pm
[15:15:00] => 3:15pm
[15:30:00] => 3:30pm
[15:45:00] => 3:45pm
[16:00:00] => 4:00pm
[16:15:00] => 4:15pm
[16:30:00] => 4:30pm
[16:45:00] => 4:45pm
[17:00:00] => 5:00pm
[17:15:00] => 5:15pm
[17:30:00] => 5:30pm
[17:45:00] => 5:45pm
[18:00:00] => 6:00pm
[18:15:00] => 6:15pm
[18:30:00] => 6:30pm
[18:45:00] => 6:45pm
[19:00:00] => 7:00pm
[19:15:00] => 7:15pm
[19:30:00] => 7:30pm
[19:45:00] => 7:45pm
[20:00:00] => 8:00pm
[20:15:00] => 8:15pm
[20:30:00] => 8:30pm
[20:45:00] => 8:45pm
[21:00:00] => 10:00pm
[21:15:00] => 9:15pm
[21:30:00] => 9:30pm
[21:45:00] => 9:45pm
[22:00:00] => 10:00pm
[22:15:00] => 10:15pm
[22:30:00] => 10:30pm
[22:45:00] => 10:45pm
[23:00:00] => 11:00pm
[23:15:00] => 11:15pm
[23:30:00] => 11:30pm
[23:45:00] => 11:45pm
[00:00:00] => 12:00am
)
[default_value] => Array
(
[0] => 07:00:00
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[ajax] => 0
[return_format] => value
[placeholder] =>
)
[1] => Array
(
[ID] => 10251
[key] => field_5b21692cf6094
[label] => End Time
[name] => event_end_time
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 1
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10249
[wrapper] => Array
(
[width] => 33
[class] =>
[id] =>
)
[_name] => event_end_time
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[06:00:00] => 6:00am
[06:15:00] => 6:15am
[06:30:00] => 6:30am
[06:45:00] => 6:45am
[07:00:00] => 7:00am
[07:15:00] => 7:15am
[07:30:00] => 7:30am
[07:45:00] => 7:45am
[08:00:00] => 8:00am
[08:15:00] => 8:15am
[08:30:00] => 8:30am
[08:45:00] => 8:45am
[09:00:00] => 9:00am
[09:15:00] => 9:15am
[09:30:00] => 9:30am
[09:45:00] => 9:45am
[10:00:00] => 10:00am
[10:15:00] => 10:15am
[10:30:00] => 10:30am
[10:45:00] => 10:45am
[11:00:00] => 11:00am
[11:15:00] => 11:15am
[11:30:00] => 11:30am
[11:45:00] => 11:45am
[12:00:00] => 12:00pm
[12:15:00] => 12:15pm
[12:30:00] => 12:30pm
[12:45:00] => 12:45pm
[13:00:00] => 1:00pm
[13:15:00] => 1:15pm
[13:30:00] => 1:30pm
[13:45:00] => 1:45pm
[14:00:00] => 2:00pm
[14:15:00] => 2:15pm
[14:30:00] => 2:30pm
[14:45:00] => 2:45pm
[15:00:00] => 3:00pm
[15:15:00] => 3:15pm
[15:30:00] => 3:30pm
[15:45:00] => 3:45pm
[16:00:00] => 4:00pm
[16:15:00] => 4:15pm
[16:30:00] => 4:30pm
[16:45:00] => 4:45pm
[17:00:00] => 5:00pm
[17:15:00] => 5:15pm
[17:30:00] => 5:30pm
[17:45:00] => 5:45pm
[18:00:00] => 6:00pm
[18:15:00] => 6:15pm
[18:30:00] => 6:30pm
[18:45:00] => 6:45pm
[19:00:00] => 7:00pm
[19:15:00] => 7:15pm
[19:30:00] => 7:30pm
[19:45:00] => 7:45pm
[20:00:00] => 8:00pm
[20:15:00] => 8:15pm
[20:30:00] => 8:30pm
[20:45:00] => 8:45pm
[21:00:00] => 10:00pm
[21:15:00] => 9:15pm
[21:30:00] => 9:30pm
[21:45:00] => 9:45pm
[22:00:00] => 10:00pm
[22:15:00] => 10:15pm
[22:30:00] => 10:30pm
[22:45:00] => 10:45pm
[23:00:00] => 11:00pm
[23:15:00] => 11:15pm
[23:30:00] => 11:30pm
[23:45:00] => 11:45pm
[00:00:00] => 12:00am
)
[default_value] => Array
(
[0] => 08:00:00
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[ajax] => 0
[return_format] => value
[placeholder] =>
)
)
)
[3] => Array
(
[ID] => 10225
[key] => field_5b21589526e22
[label] => Recurring Day(s)
[name] => event_recurring_days
[prefix] => acf
[type] => checkbox
[value] =>
[menu_order] => 3
[instructions] => Select the day(s) of the week the event will reoccur. If you select Thursday, the event will repeat EVERY Thursday. You can select more than one day of the week.
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10221
[wrapper] => Array
(
[width] =>
[class] =>
[id] =>
)
[_name] => event_recurring_days
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[sunday] => Sunday
[monday] => Monday
[tuesday] => Tuesday
[wednesday] => Wednesday
[thursday] => Thursday
[friday] => Friday
[saturday] => Saturday
)
[allow_custom] => 0
[save_custom] => 0
[default_value] => Array
(
)
[layout] => horizontal
[toggle] => 0
[return_format] => value
)
)
)
[4] => Array
(
[ID] => 10230
[key] => field_5b215ddc9226e
[label] => Recurring Monthly
[name] => event_recurring_monthly
[prefix] => acf
[type] => repeater
[value] =>
[menu_order] => 4
[instructions] => Select the week number and day of the week the event will reoccur.
[required] => 0
[id] =>
[class] =>
[conditional_logic] => Array
(
[0] => Array
(
[0] => Array
(
[field] => field_5b21449202e42
[operator] => ==
[value] => monthly
)
)
)
[parent] => 10198
[wrapper] => Array
(
[width] =>
[class] =>
[id] =>
)
[_name] => event_recurring_monthly
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[collapsed] =>
[min] => 1
[max] => 0
[layout] => block
[button_label] => Add Recurrance
[sub_fields] => Array
(
[0] => Array
(
[ID] => 10231
[key] => field_5b215e4292273
[label] => Start Date
[name] => event_start_date
[prefix] => acf
[type] => date_picker
[value] => 12/19/2018
[menu_order] => 0
[instructions] => Date the event will start recurring.
[required] => 1
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10230
[wrapper] => Array
(
[width] => 15
[class] =>
[id] =>
)
[_name] => event_start_date
[_prepare] => 0
[_valid] => 1
[display_format] => m/d/Y
[return_format] => Ymd
[first_day] => 0
)
[1] => Array
(
[ID] => 10232
[key] => field_5b215e6292274
[label] => End Date
[name] => event_end_date
[prefix] => acf
[type] => date_picker
[value] =>
[menu_order] => 1
[instructions] => Leave blank if there is no end date.
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10230
[wrapper] => Array
(
[width] => 15
[class] =>
[id] =>
)
[_name] => event_end_date
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[display_format] => m/d/Y
[return_format] => Ymd
[first_day] => 0
)
[2] => Array
(
[ID] => 10233
[key] => field_5b215e9e92275
[label] => Recurring Week
[name] => event_recurring_week
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 2
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10230
[wrapper] => Array
(
[width] => 14
[class] =>
[id] =>
)
[_name] => event_recurring_week
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[first] => First
[second] => Second
[third] => Third
[fourth] => Fourth
)
[default_value] => Array
(
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[ajax] => 0
[return_format] => value
[placeholder] =>
)
[3] => Array
(
[ID] => 10234
[key] => field_5b215eed92276
[label] => Day
[name] => event_recurring_day
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 3
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10230
[wrapper] => Array
(
[width] => 14
[class] =>
[id] =>
)
[_name] => event_recurring_day
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[sunday] => Sunday
[monday] => Monday
[tuesday] => Tuesday
[wednesday] => Wednesday
[thursday] => Thursday
[friday] => Friday
[saturday] => Saturday
)
[default_value] => Array
(
[0] => friday
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[ajax] => 0
[return_format] => value
[placeholder] =>
)
[4] => Array
(
[ID] => 10257
[key] => field_5b216a933dfdc
[label] => Time
[name] => event_time
[prefix] => acf
[type] => repeater
[value] =>
[menu_order] => 4
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10230
[wrapper] => Array
(
[width] => 40
[class] =>
[id] =>
)
[_name] => event_time
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[collapsed] =>
[min] => 1
[max] => 0
[layout] => table
[button_label] => Add Time
[sub_fields] => Array
(
[0] => Array
(
[ID] => 10258
[key] => field_5b216aa53dfdd
[label] => Start Time
[name] => event_start_time
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 0
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10257
[wrapper] => Array
(
[width] => 49
[class] =>
[id] =>
)
[_name] => event_start_time
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[06:00:00] => 6:00am
[06:15:00] => 6:15am
[06:30:00] => 6:30am
[06:45:00] => 6:45am
[07:00:00] => 7:00am
[07:15:00] => 7:15am
[07:30:00] => 7:30am
[07:45:00] => 7:45am
[08:00:00] => 8:00am
[08:15:00] => 8:15am
[08:30:00] => 8:30am
[08:45:00] => 8:45am
[09:00:00] => 9:00am
[09:15:00] => 9:15am
[09:30:00] => 9:30am
[09:45:00] => 9:45am
[10:00:00] => 10:00am
[10:15:00] => 10:15am
[10:30:00] => 10:30am
[10:45:00] => 10:45am
[11:00:00] => 11:00am
[11:15:00] => 11:15am
[11:30:00] => 11:30am
[11:45:00] => 11:45am
[12:00:00] => 12:00pm
[12:15:00] => 12:15pm
[12:30:00] => 12:30pm
[12:45:00] => 12:45pm
[13:00:00] => 1:00pm
[13:15:00] => 1:15pm
[13:30:00] => 1:30pm
[13:45:00] => 1:45pm
[14:00:00] => 2:00pm
[14:15:00] => 2:15pm
[14:30:00] => 2:30pm
[14:45:00] => 2:45pm
[15:00:00] => 3:00pm
[15:15:00] => 3:15pm
[15:30:00] => 3:30pm
[15:45:00] => 3:45pm
[16:00:00] => 4:00pm
[16:15:00] => 4:15pm
[16:30:00] => 4:30pm
[16:45:00] => 4:45pm
[17:00:00] => 5:00pm
[17:15:00] => 5:15pm
[17:30:00] => 5:30pm
[17:45:00] => 5:45pm
[18:00:00] => 6:00pm
[18:15:00] => 6:15pm
[18:30:00] => 6:30pm
[18:45:00] => 6:45pm
[19:00:00] => 7:00pm
[19:15:00] => 7:15pm
[19:30:00] => 7:30pm
[19:45:00] => 7:45pm
[20:00:00] => 8:00pm
[20:15:00] => 8:15pm
[20:30:00] => 8:30pm
[20:45:00] => 8:45pm
[21:00:00] => 10:00pm
[21:15:00] => 9:15pm
[21:30:00] => 9:30pm
[21:45:00] => 9:45pm
[22:00:00] => 10:00pm
[22:15:00] => 10:15pm
[22:30:00] => 10:30pm
[22:45:00] => 10:45pm
[23:00:00] => 11:00pm
[23:15:00] => 11:15pm
[23:30:00] => 11:30pm
[23:45:00] => 11:45pm
[00:00:00] => 12:00am
)
[default_value] => Array
(
[0] => 07:00:00
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[ajax] => 0
[return_format] => value
[placeholder] =>
)
[1] => Array
(
[ID] => 10259
[key] => field_5b216ad03dfde
[label] => End Time
[name] => event_end_time
[prefix] => acf
[type] => select
[value] =>
[menu_order] => 1
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => 0
[parent] => 10257
[wrapper] => Array
(
[width] => 49
[class] =>
[id] =>
)
[_name] => event_end_time
[_prepare] => 0
[_valid] => 1
[user_roles] => Array
(
[0] => all
)
[choices] => Array
(
[06:00:00] => 6:00am
[06:15:00] => 6:15am
[06:30:00] => 6:30am
[06:45:00] => 6:45am
[07:00:00] => 7:00am
[07:15:00] => 7:15am
[07:30:00] => 7:30am
[07:45:00] => 7:45am
[08:00:00] => 8:00am
[08:15:00] => 8:15am
[08:30:00] => 8:30am
[08:45:00] => 8:45am
[09:00:00] => 9:00am
[09:15:00] => 9:15am
[09:30:00] => 9:30am
[09:45:00] => 9:45am
[10:00:00] => 10:00am
[10:15:00] => 10:15am
[10:30:00] => 10:30am
[10:45:00] => 10:45am
[11:00:00] => 11:00am
[11:15:00] => 11:15am
[11:30:00] => 11:30am
[11:45:00] => 11:45am
[12:00:00] => 12:00pm
[12:15:00] => 12:15pm
[12:30:00] => 12:30pm
[12:45:00] => 12:45pm
[13:00:00] => 1:00pm
[13:15:00] => 1:15pm
[13:30:00] => 1:30pm
[13:45:00] => 1:45pm
[14:00:00] => 2:00pm
[14:15:00] => 2:15pm
[14:30:00] => 2:30pm
[14:45:00] => 2:45pm
[15:00:00] => 3:00pm
[15:15:00] => 3:15pm
[15:30:00] => 3:30pm
[15:45:00] => 3:45pm
[16:00:00] => 4:00pm
[16:15:00] => 4:15pm
[16:30:00] => 4:30pm
[16:45:00] => 4:45pm
[17:00:00] => 5:00pm
[17:15:00] => 5:15pm
[17:30:00] => 5:30pm
[17:45:00] => 5:45pm
[18:00:00] => 6:00pm
[18:15:00] => 6:15pm
[18:30:00] => 6:30pm
[18:45:00] => 6:45pm
[19:00:00] => 7:00pm
[19:15:00] => 7:15pm
[19:30:00] => 7:30pm
[19:45:00] => 7:45pm
[20:00:00] => 8:00pm
[20:15:00] => 8:15pm
[20:30:00] => 8:30pm
[20:45:00] => 8:45pm
[21:00:00] => 10:00pm
[21:15:00] => 9:15pm
[21:30:00] => 9:30pm
[21:45:00] => 9:45pm
[22:00:00] => 10:00pm
[22:15:00] => 10:15pm
[22:30:00] => 10:30pm
[22:45:00] => 10:45pm
[23:00:00] => 11:00pm
[23:15:00] => 11:15pm
[23:30:00] => 11:30pm
[23:45:00] => 11:45pm
[00:00:00] => 12:00am
)
[default_value] => Array
(
[0] => 08:00:00
)
[allow_null] => 0
[multiple] => 0
[ui] => 0
[ajax] => 0
[return_format] => value
[placeholder] =>
)
)
)
)
)
)
)
This is my code:
$date_meta = array();
$date_meta['field_5b21449202e42'] = 'date'; //event_date_type
$date_meta['field_5b2145b902e43'][0] = array( //event_single_day
'field_5b21463202e44' => $date, //event_date
'field_5b2146c83d961' => array( //event_time
0 => array(
'field_5b2147733d964' => $time, //event_start_time
'field_5b2147af3d965' => $time, //event_end_time
)
)
);
update_field( 'field_5b21463202e44', $date_meta, $id ); //event_date
error_log( print_r( get_field( 'field_5b21463202e44', $id ), true ) );
error_log shows “false”.
If I look at the raw fields, “event_date” has the array stored as an array and none of the ACF FIELDs are created.
Okay, that seems to work with a very simply repeater field.
Try this. Create a Group. Within that group, create a repeater with 3 fields.
Create a post in the admin area as normal.
Use the FIELD_ID and the POST_ID in get_field() to get the data for that group. You should get a nested array.
Modify that array and use update_field() to put the data back. It should work just fine.
Now, wp_insert_post() to create a post. Use get_field() to get the data from the first post with valid data. Use update_field() to copy that data into the new post. If fails.
field_5c1abd11a3f55 is a repeater?
And field_5c1abd1da3f56 is a text field?
Pretty serious bug with no update in over a week…. ๐
Thank you, I had two issues with my code…
First (as you noted) I was using “name=field_key” which was wrong, it should have been “key=field_key”.
Second, “load_value” is not filtered for messages. However, “load_field” is and I was able to use that.
// Add ACF form support for tscpl-pb-export submenu page
function tscpl_add_acf_head() {
if ( get_current_screen()['base'] == 'admin_page_tscpl-pb-export' ) {
acf_form_head();
}
}
add_action( 'get_header', 'tscpl_add_acf_head', 1 );
So, I create a Sub Menu page using add_submenu_page()
and ACF is not loaded for that page. Adding acf_form_head()
manually fixed my problem.
Okay, so the selected taxonomy itself is stored as the ID in the custom field. ACF lets you decide how you want the info returned. So I just need to search for the ID.
So, I am storing the Term Object.
How do I search it, then?
So, update_field() does iterate through an array. It helps to read the docs…
“The fieldโs key should be used when saving a new value to a post (when no value exists).”
What I am curious about is can I pass an empty string to update all of the field data… But for now I am able to use a nested array to update my groups/repeaters.
Then how does ACF determine what fields to display for a NEW post-type?
There has to be some way to determine what field groups are used by a specific post type.
The ACF timepicker bites. ๐
I’m writing an addon plugin to use this:
http://jonthornton.github.io/jquery-timepicker/
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.