+10 votes
in Programming by (11.7k points)
Wordpress Image Teleporter plugin does not work with special characters, it shows broken image, how can I fix it?

1 Answer

+11 votes
by (10.4k points)

Go to Wordpress -> Plugins -> Image Teleporter -> Edit


require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/media.php');

Add this under above

function clean($string) {
   $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
   $string = preg_replace('/[^A-Za-z0-9\-\.\\/]/', '', $string); // Removes special chars.
   return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
Find this : 
$trans = preg_quote($imgs[$i], "/");
Add this under above : 
$imgpath = clean($imgpath);
Now it works! :)


Ask a Question
Welcome to WikiTechSolutions where you can ask questions and receive answers from other members of the community.

You can ask a question without registration.