Skip to content Skip to sidebar

Resolved

Resolved in: WPML 4.9.3

Topic Tags: Bug

Overview of the issue

When content is translated and the Media Translation plugin is active, the image urls in the translated content may include double slashes. The images still appear as normal, but this can have some unintended side-effects with 3rd parties.

Note, this issue only happens if the default WordPress setting “Organize my uploads into month- and year-based folders” is disabled.

Workaround

While awaiting a fix, the problem can be avoided (for new translations) by editing the file plugins/wpml-media-translation/classes/media-translation/class-wpml-media-image-translate.php

Locate these lines (around line 211):

			$filename          = array_pop( $file_subdirectory_parts );
			$image_url_parts[] = implode( '/', $file_subdirectory_parts );

and edit like so:

			$filename          = array_pop( $file_subdirectory_parts );
			if ( !empty( $file_subdirectory_parts ) ) {
				$image_url_parts[] = implode( '/', $file_subdirectory_parts );
			}

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>