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>
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.
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.
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.
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.
The topic ‘[Closed] SVG Support bug with media metadata duplication’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.