Skip to main content
Incorporated external code in the answer.
Source Link
brasofilo
  • 22.1k
  • 8
  • 69
  • 264

Use addslashes in PHP.

This way just work: As described in How to get Advanced Custom Fields image url paththis page (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')); ?>

Use addslashes in PHP.

This way just work: How to get Advanced Custom Fields image url path

Use addslashes in PHP.

As described in this page (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')); ?>
Source Link

Use addslashes in PHP.

This way just work: How to get Advanced Custom Fields image url path