Background of the issue:
I am trying to translate a blog post using the classic editor view and the normal flow (ATE). In the original version, images have a 'link to media file.'
Symptoms:
After translation, the image links change to 'custom link,' causing only the thumbnail to open in the lightbox instead of the full-size image. Manually changing it back to 'link to media file' resolves the issue.
Questions:
Why do image links change from 'link to media file' to 'custom link' after translation?
How can I ensure that image links remain as 'link to media file' during translation?
Christopher is currently unavailable. I have confirmed that the issue has been reported, but there are no updates at this time. We will update you here as soon as more information is available.
Would you please update WPML to version 4.7.3 and also update WPML String translation? Then please cehck by adding a new media and see if the issue is still there or not.
We have found that the problem might occur when there are some characters used in the image names that are like spaces but not actual space. For example the Mac devices create images when using the screenshot tool with that format.
WordPress do not replace such characters to hyphens and that was the problem cause.
If you want to avoid such scenarios you can use the code below which you can add to your functions.php file of your theme:
/**
* Normalise ALL Unicode space-separator characters to a dash.
*
*/
add_filter( 'sanitize_file_name', 'wpmlsupp_normalise_unicode_spaces', 5, 2 );
function wpmlsupp_normalise_unicode_spaces( $sanitised, $raw_filename ) {
// Collapse every Unicode *space separator* (general-category Zs) to a single dash
// Examples caught here: U+00A0 (NO-BREAK SPACE), U+202F (NARROW NBSP), U+2009 (THIN SPACE), etc.
$raw_filename = preg_replace( '/\p{Zs}+/u', '-', $raw_filename );
return $raw_filename;
}
The code above will not fix the issue for the current images but for future uploads. But the best way is to avoid using any special characters in your images.
But there are no breaks or spaces in the file names. The file name structure is always the same, containing only lowercase letters, numbers, and the characters “-” and “_”.
I tested that on the installation below and it worked ok if I used a normal image name:
hidden link
Would you please add a test page there and use one of your images to see if the issue can be seen?
Thanks.
The topic ‘[Closed] Wrong image link.’ 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.