Hi Kristof,
Thank you for waiting.
I've performed some detailed testing and troubleshooting on your website's clone and on my own fresh install, but couldn't reproduce the issue of duplicate entries for the image fields.
I did notice that there are 3 existing posts on your website, which have these duplicate images:
FR:
Appartement Monte do Facho - ID: 1092
yourwebsite.com/fr/accommodation/appartement-neuf-a-louer-a-foz-do-arelho/
EN:
Apartment Cocquyt - ID: 1192
yourwebsite.com/en/accommodation/apartment-cocquyt/
Apartment Monte do Facho - ID: 1075
yourwebsite.com/en/accommodation/new-apartment-for-rent-in-foz-do-arelho/
NL:
None
To remove these duplicates, I'll suggest the following steps:
1. Please make a complete backup copy of the website.
2. Temporarily include the following custom shortcode, in the active theme's "functions.php" file:
function update_image_gallery_func( $atts ) {
$a = shortcode_atts( array(
'id' => '',
), $atts );
// get existing values
$orig_array = get_post_meta( $a['id'], 'wpcf-image-gallery' );
// store unique values in a temp array
$final_array = array_unique($orig_array);
// delete the existing values
delete_post_meta($a['id'], 'wpcf-image-gallery');
// add the unique values only
foreach ($final_array as $key => $value) {
add_post_meta($a['id'], 'wpcf-image-gallery', $value, false);
}
}
add_shortcode( 'update-image-gallery', 'update_image_gallery_func' );
This shortcode will get the current values saved in post's "image-gallery" custom field and will only keep the unique ones.
3. Create a temporary page and in its content, add this new shortcode, for each of the posts with duplicate images:
[update-image-gallery id="1092"]
[update-image-gallery id="1192"]
[update-image-gallery id="1075"]
Save the page and view its frontend.
( it won't show anything, but will do the processing in the backend )
4. After this page has been viewed, check those posts to see if the duplicate images have been removed.
5. Once the duplicates are removed, you can remove this temporary page and the shortcode from the website.
The issue on these posts can be due to migration or post duplication, but in case you or your client notice this issue re-appear for any other posts, please let us know, with the specific details of what changes were made when this issue reappeared.
I hope this helps and please let me know how it goes.
regards,
Waqar