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
10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 - -
16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 - -

Supporter timezone: Asia/Jerusalem (GMT+03:00)

Tagged: 

This topic contains 8 replies, has 0 voices.

Last updated by Itamar 6 months ago.

Assisted by: Itamar.

Author Posts
November 25, 2024 at 11:17 am #16439322

nathanR-5

I am trying to upload an SVG with the SVG Support plugin enabled, but the metadata for the image is not copied into the media for translations other than the default language.

This is because the SVG Support plugin generates the metadata on the wp_generate_attachment_metadata hook at priority 10, and WPML adds WPML_Media_Attachments_Duplication::wp_generate_attachment_metadata also at priority 10. For whatever reason, WPML's hook runs before SVG Support's, meaning the metadata does not exist yet.

A long term fix would be to update the priority of WPML_Media_Attachments_Duplication::wp_generate_attachment_metadata to 15, but a temporary workaround can be added as below in the theme's function.php:

<pre>
use function WPMLContainermake;

if (class_exists('WPML_Media_Attachments_Duplication')) {
            remove_filter('wp_generate_attachment_metadata', array(make(WPML_Media_Attachments_Duplication::class), 'wp_generate_attachment_metadata'), 10);
            add_filter('wp_generate_attachment_metadata', array(make(WPML_Media_Attachments_Duplication::class), 'wp_generate_attachment_metadata'), 11, 2);
}
</pre>
November 25, 2024 at 11:39 am #16439386

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Thanks for reporting this issue. Please check the following errata page. It might be related to your problem.

https://wpml.org/errata/svg-support-activating-wpml-media-strips-uploads-folders-from-svg-image-url/

If it is entirely the same issue, please let me know.

If you need further help, please share your site's Debug information. You can read about it here.

http://wpml.org/faq/provide-debug-information-faster-support/

Thanks,
Itamar.

November 25, 2024 at 1:34 pm #16439976

nathanR-5

Hi Itamar,

Thanks - I already checked this, and this is a completely unrelated problem.

I am reposting the code here as the formatting broke at some point in my original post:

use function \WPML\Container\make;
 
if (class_exists('WPML_Media_Attachments_Duplication')) {
            remove_filter('wp_generate_attachment_metadata', array(make(WPML_Media_Attachments_Duplication::class), 'wp_generate_attachment_metadata'), 10);
            add_filter('wp_generate_attachment_metadata', array(make(WPML_Media_Attachments_Duplication::class), 'wp_generate_attachment_metadata'), 11, 2);
}
November 27, 2024 at 7:05 pm #16451479

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Thanks.

I'm consulting our second-tier supporters about this issue. I'll update you here once I have their reply.

Regards,
Itamar.

November 28, 2024 at 12:08 pm #16454888

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Can you please replicate this issue on a fresh WordPress installation?
Then, I'll be able to escalate it to our compatibility team. For this, I created a test website with a clean WordPress install. You can access it through this link:

hidden link

With this link, you'll be directly logged in.

Could you please install the SVG Support plugin and see if the issue is replicable on a clean WordPress installation?

Please configure WPML (just the basic configurations needed to replicate the issue are enough).

Please also ensure you install the latest version of the plugin.

Please let us know when everything is finished, and you can replicate the problem.

Important! Do not import your site to the test site. We must replicate the problem on a fresh, clean WordPress installation.

Thanks,
Itamar.

December 10, 2024 at 11:28 am #16497740

nathanR-5

Sorry, I missed this.

But the replication steps are literally to install SVG Support and WPML, add at least one language other than the site default, and then upload an SVG.

December 10, 2024 at 4:26 pm #16499650

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Thanks.

I was unable to replicate this issue on a sandbox site, upon uploading a SVG file and adding meta data the translated file replicated this data. I could then proceed and translate the meta data. Please see the attached screenshot.

Have I missed something?

If you'd like, please help us to replicate the issue on our sandbox site here.

hidden link

Thanks,
Itamar.

2024-12-10_18-19-51.jpg
December 11, 2024 at 9:29 am #16502372

nathanR-5

Most curious!

I will have to investigate then as it might be caused by an additional plugin (such as Offload Media). Please bear with me.

December 11, 2024 at 4:02 pm #16504487

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Sure, keep me updated.

I did not mention in this ticket until now that the SVG Support plugin is not currently compatible with WPML. You may experience issues when using it. You can read about it here: https://wpml.org/plugin/svg-support/.

The WP Offload Media plugin is officially compatible with WPML.

https://wpml.org/plugin/wp-offload-s3/
hidden link

Regards,
Itamar.

The topic ‘[Closed] SVG Support bug with media metadata duplication’ is closed to new replies.