Use **addslashes** in PHP. As described in [this page][1] (in chinese), this would work: $main_car_pic = addslashes(get_field('car_photo')); $reg_ext = "#.jpg#i"; $thumb_ext = "-150x150.jpg"; $car_thumb = preg_replace($reg_ext, $thumb_ext, $main_car_pic); echo $car_thumb Or simply like this: <?php echo addslashes(get_field('field_name')); ?> [1]: http://blog.linz.im/2012/acf-image-url.html