Skip Navigation

[Resolved] Continued – The uploaded images to the original post are different from the…

This support ticket is created 5 years, 8 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 10 replies, has 2 voices.

Last updated by Waqar 5 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#1251227

Referring to closed ticket https://toolset.com/forums/topic/the-uploaded-images-to-the-original-post-are-different-from-the-translated-post/

Hi,
We are having a hard time getting feedback from our client, so we took a look ourselves and we do experience this problem with an existing post
NL is fine hidden link
EN is not ok hidden link
FR is fine hidden link

wpcf-image-gallery is set to "copy"
I have deleted the duplicate images in EN and saved the post, reload the page, the duplicate images are still there.
I have deleted the duplicate images in EN and saved the post, switched to NL and also saved that post (without mods), switched back to EN, the duplicate images are still there.

I have used this approach on another corrup post earlier today and it worked then, but not with this post.

#1251583

Hi Kristof,

Thanks for writing back and for sharing these details.

Just as Christian, I was not able to reproduce this behavior on my own test website, during initial testing. This leads to believe that this is something specific to your website.

For further troubleshooting, I'll need a fresh clone/snapshot of your website. I have the admin area access details from the last ticket but do I have your permission to install the "Duplicator" plugin on your website ( https://wordpress.org/plugins/duplicator/ ) and download the clone/snapshot?

Also if you noticed anything different.odd while editing this post's NL, EN or FR versions, that will also help in the investigation.

regards,
Waqar

#1251599

Hi Waqar,
You have my permission.
No, I did not notice anything strange except that the issue is only in ENG, not in the FR translation. Even if we delete all images from the ENG gallery and save the page, they "magically" appear again, I have no idea where they come from.

#1251685

Hi Kristof,

Thank you for your permission.

I tried to create a duplicator package of your website, but it seems your server's security policies or disk space is not allowing it to run properly.

Can you please temporarily disabled all security plugins and create a duplicator package?

Here is a guide on how to create and share a duplicator package:
https://toolset.com/faq/provide-supporters-copy-site/

Note: Your next reply will be private so that you can share the duplicator files, securely.

In case the Duplicator plugin still doesn't work on your server, I'll have to download the website's files manually, using the FTP access.
( the FTP access details from your earlier message are not working, so please also share updated FTP access )

regards,
Waqar

#1251697

I have freed some disk space.

#1252641

Hi Kristof,

Thank you for freeing up some disk space and it fixed the issue with the duplicator package.

I was able to successfully deploy a duplicator package from your website and on my own server.

Currently, I'm performing some troubleshooting around the duplicated image entries and will update you with my findings, as soon as it completes.

Thank you for your patience.

regards,
Waqar

#1254235

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

#1271931

Please allow me a few more days to test the above code.
Client reports that it happens when he edits the existing /original gallery.

#1272201

Hi Kristof,

Please take your time and I'll wait to hear back from you.

regards,
Waqar

#1272389

Hi Waqar,

I have followed your instructions with the shortcode. Most of the time this fixed the issue with the duplicate images, but sometimes there was only 1 image left, so I had to open the original Dutch post and Save it, then the images were copied again to the translations.

At this moment all duplicate images have been removed, yay! 🙂

But I would like to keep this ticket open for just a bit longer so our client can evaluate after the next post he creates.

#1272513

Hi Kristof,

Thanks for the update and glad that the duplicate images have been removed.

This ticket will stay open for a few weeks, so feel free to share any further updates here.

regards,
Waqar