We are using Toolset Forms for the purposes of front end creation and editing of posts. One of these fields is an Image field which is set to "Allow multiple instances of this field", ie be a repeating field.
Up until sometime earlier this year drop and drop reordering of images was working fine. Now, after software updates, the new order of images does not save when post is saved using the front end form. However, the images can be reordered successfully via the back end.
I checked this on an older development version of the same site (aos.liquidedge.co.nz) where software hadn't been updated. It was running Toolset Forms version 2.6.13 and the drag and drop reordering was working fine. When I updated WordPress from 6.0.6 to 6.3.2 and updated Toolset plugins to latest versions (Forms to 2.6.17) the drag and drop reordering stopped being saved on the dev site too.
I've deactivated all other plugins apart from the four Toolset plugins we are using (Access, Forms, Maps, Types, Views) and this has not solved the problem on the dev site. (I have not attempted this on the live site.)
I have switched on debugging and no errors are being recorded.
I have checked a completely different site that also happens to have a repeating image field on a front end form and the problem is happening there too.
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 custom image field slug.
Given this is a known issue, I'm surprised my Google and forum searches didn't find the answer earlier. Please advise where this patch was published in your documentation etc?