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.

This topic contains 2 replies, has 2 voices.

Last updated by Pierre 2 years, 1 month ago.

Assigned support staff: Bruno.

Author Posts
May 24, 2018 at 11:52 pm


Hi, I use ShortPixel to compress my images. This plugin is not officially compatible with WPML but I'm trying to find a solution to my problem.

When I add an "Additional media folder" in settings => ShortPixel => Advanced tab (IMG folder in the WP root folder), then start a compression process, I got an error 404 message (image not found) cuz the folder URL is wrong. Instead of scanning the folder, it scans folder.

I've created a test WordPress with only WPML and Shrtpixel plugins and the problem is the same so I guess it's a compatibility issue.

Is there a solution for this compatibility issue?


PS: If you make some test, be aware that the free version of Shortpixel allows to compress only 100 images per month, so use it carefully 😉

May 25, 2018 at 10:59 pm #2231835


Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)


Thank you for contacting us. Please, my sincere apologies for the delay in answering.

This problem should be happening because you are using the WPML > Languages > Language URL format > Use directory for default language option. This way, the default URL in the default language is

Also, on the wp-content/plugins/shortpixel-image-optimiser/class/db/shortpixel-meta-facade.php on line 307, the Shortpixel is using the home_url function:

return trailingslashit((function_exists("is_multisite") && is_multisite()) ? 
trim(network_site_url("/")) : trim(home_url()));

We can change the home_url function to site_url function:

return trailingslashit((function_exists("is_multisite") && is_multisite()) ? trim(network_site_url("/")) : trim(site_url()));

The WPML filters the "home_url" function to display the URL according to the language (,, etc). To fix this, we can use the "site_url" function, which will get only the domain of the site (

Making this small change in code or not using the "Use directory for default language" option, should work properly.

* Note: in your test environment I made the change in the code above to test. This worked correctly. I'll attach an image for you to see.

* Also note that in order not to consume your limit of 100 images, I created an account and used a different key for this test.

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

May 28, 2018 at 7:02 am #2236556


Hi Bruno,

thanks a lot, your solution worked prefectly.

I posted a message in the wordpress plugin support page :