I finished a website in Wordpress and it does not load the images in both Safari and Iphone.
I finished a website in Wordpress and it does not load the images in both Safari and Iphone.
I was able to solve the problem by adding the following script, but with priority at 90
/* Remover acento da url das imagens (Para abrir normalmente no Safari)*/
add_filter( 'wp_get_attachment_image_attributes', 'ck_image_attrs', 90 );
function ck_image_attrs($attrs)
{
foreach ($attrs as $name => $value)
{
if ('src' != $name)
{
break;
}
$attrs[$name] = ck_fix_image_url($value);
}
return $attrs;
}
function ck_fix_image_url($url)
{
$parts = parse_url($url);
$path = explode('/', $parts['path']);
$path = array_map('rawurlencode', $path);
$path = implode('/', $path);
return str_replace($parts['path'], $path, $url);
}
Source: link