[Cerrado] Repeating Fields Drag & Drop “Sort Order” Not Saved
This support ticket is created hace 10 meses. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
Sun
Mon
Tue
Wed
Thu
Fri
Sat
-
10:00 – 13:00
10:00 – 13:00
10:00 – 13:00
10:00 – 13:00
10:00 – 13:00
-
-
14:00 – 18:00
14:00 – 18:00
14:00 – 18:00
14:00 – 18:00
14:00 – 18:00
-
Supporter timezone: Asia/Kolkata (GMT+05:30)
Este tema contiene 3 respuestas, tiene 2 mensajes.
I am trying to:
Use front end forms to edit a post. The post type uses repeating fields. When I drag & drop the fields to arrange sort order, the changes are not saved (DOES NOT WORK).
When I use the back end WP admin editor to perform the same steps (i.e. drag & drop the fields to arrange sort order), the changes are saved (WORKS).
Link to a page where the issue can be seen: enlace oculto
This is the front end form used to manage user profiles.
The Post Field Group is here: enlace oculto
The Post Form is here: enlace oculto
The Content Template is here: enlace oculto
Please be sure to redact those URLs for public display.
Hello. Thank you for contacting the Toolset support.
This is a known issue to us and the workaround to save the sort order for the repeating field is to use "cred_save_data" form's hook:
You can add the following code to "Custom Code" section offered by Toolset and add a new code snippet (do not forget to activate the code snippet) and add the following code to it:
add_action('cred_save_data', 'ts_save_the_rf_sort_order_manually',10,2);
function ts_save_the_rf_sort_order_manually($post_id, $form_data) {
// if a specific form
if ($form_data['id']==99999) {
$field_slug = 'media-gallery';
$field_content = $_POST['wpcf-'.$field_slug];
$sort_order = array();
delete_post_meta($post_id,'wpcf-'.$field_slug);
foreach($field_content as $k=>$v):
$sort_order[] = add_post_meta($post_id,'wpcf-'.$field_slug,$v);
endforeach;
update_post_meta($post_id,'_wpcf-'.$field_slug.'-sort-order', $sort_order);
}
}
Where:
- Replace 99999 with your original form ID
- Replace "media-gallery" with your original field slug
Hi Minesh,
Thanks for the code snippet. I followed your instructions and applied the code. Unfortunately, the front-end drag & drop sort is still not working.
If you like, I can provide the code snippet and settings I am using or you can log in to see for yourself. Additionally, is it possible to modify the code so that the $field_slug is a an array since more than one field requires drag & drop sort.