Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 15:00 8:00 – 15:00 8:00 – 15:00 8:00 – 15:00 8:00 – 15:00 -
- 16:00 – 17:00 16:00 – 17:00 16:00 – 17:00 16:00 – 17:00 16:00 – 17:00 -

Supporter timezone: Europe/Rome (GMT+02:00)

This topic contains 5 replies, has 2 voices.

Last updated by Alejandro 1 year, 10 months ago.

Assisted by: Alejandro.

Author Posts
June 21, 2022 at 5:48 am

daveB-11

Media are duplicated multiple times in default language after wpml is enabled.

June 21, 2022 at 6:35 am
June 21, 2022 at 8:44 am #11506303

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

The main issue can be seen here: hidden link

as you can see you are using over 90M of memory and only have 40M available plus you need a minimum of 128M (in your case more than that, since you're already using amost 100M) n order to meet our minimum requirements so let's start with that:

Please add the following code in your wp-config.php file, right after the database information lines of code:

define('WP_MEMORY_LIMIT','256M');

2) ❌ Before proceeding please make a full website backup! ❌
Go to WPML -> Support -> Troubleshooting
Press the following buttons:
• "Clear the cache in WPML"
• "Remove ghost entries from the translation tables"
• "Fix element_type collation"
• "Set language information"
• "Fix post type assignment for translations"

------------------------

I don't think that will fix the problem of the images but it will prevent other to duplicate like that.

However it also seems you have reset WPML before and that would actually explain why the content is showing duplicated as you see it right now as well, could it be that you did so?

However there's a way to fix this if you have access to your database.

You can use this query to delete all the duplicated queries: https://wpml.org/forums/topic/image-duplication-2/#post-10188479

In your case, the query would be:

DELETE FROM `wpue_posts` WHERE `post_name` LIKE '%-3%' AND `post_type` LIKE 'attachment'

and you'd have to run this query a few times changing %-3%

with:

- %-1%
- %-2%
- %-4%
- %-5%

And so on until you see that the query is not being applied to any element anymore.

Regards.

June 21, 2022 at 11:12 am #11508219

daveB-11

Still have the same issue

I remove images from -1 to -20 but still have duplicate images

This we we lost attached images also please have a look at your end actually i have a stage site so you can play with this

thanks in advance

June 21, 2022 at 11:55 am #11508633

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

if you lost attachments tell me that the attachments were the ones that you chose as the "main" image for said attachments and not the actual original image, which at the same time tells me those images existed there before since it's impossible those images are added to content otherwise.

However, i see that the duplicated image is not there already so i'm not entirely sure what else i can do here to help you, maybe i'm not understanding your new request?

Let me, however explain in detail how the query above i gave you works.

When you create an image, WordPress assigns it a slug as it would with a post (because an image is actually a post TYPE for WordPress so they have the same structure).
that slug will be unique but if the image is duplicated it will attach a "-2" "-3", etc.

This means that if you have an image that was duplicated 4 times, their slugs would probably look like this:
this-is-an-image (original)
this-is-an-image-1 (duplicate 1)
this-is-an-image-2 (duplicate 2)
this-is-an-image-3 (duplicate 3)
this-is-an-image-4 (duplicate 4)

However if you have 2 images that have the same name, they would have a similar slug:

original-image (image one called "original image")
original-image-2 (another image called "original image")

There is no way to differentiate between the 2 images WordPress doesn't really "look" at the actual image, it only looks at the slugs and the query i sent you would end up deleting that image as well.

--------------------

If you see that there are images missing, try to upload them again and if they are not attached to a page, that's only because you attached a duplicate of an image and not the original one. it was removed so it's not attached anymore and in this case you can now attach the original one.

Regards.

June 22, 2022 at 5:17 am #11515755

daveB-11

Hi,
I understand your concern but the issue is different and still need your assistance

1. Images are not duplicated in file directory its showing single time - hidden link
2. But in media library its showing multiple times - hidden link
3. But inside database its have 8 times see attached screenshot

Please have a look of all 3 cases & let me know what is the issue we have

FireShot Capture 038 -  - wordpress-695469-2648771.cloudwaysapps.com.png
June 22, 2022 at 10:30 am #11518427

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

I couldn't see the images because it seems lightshot is not working correctly, however:

1) It's normal that the images are not duplicated in the file directory because the "duplication" is just a database entry that makes WordPress believe there are images for each language

2) I checked your site and i don't see any duplicated image in one language and since i can't really see the screenshot, i'm a bit lost on what you mean here

3) I'm not sure where you're getting this or how but the images in the database should exist 1 for each language you have, again this is a database entry that allows the image to be available in the translated languages.

Regards.

The topic ‘[Closed] Media is duplicated when WPML is enabled’ is closed to new replies.