Support

Account

Home Forums ACF PRO No slashes in image URLs

Solved

No slashes in image URLs

  • Image field URLs are missing slashes. I am using an ACF image field, and I’ve tried returning both an array and an ID, and in both cases, the URL of the image file is missing the slashes. So the URL will look like:

    "http:// mysite.com wp-content uploads 2018 11 image.jpg"

    There are spaces where the slashes should be. I am using the most recent version of ACF Pro and WP, and I have no other plugins installed. I have confirmed that image URLs are correct if I add them into the main WYSIWYG editor or as featured image. I use ACF images all the time, and have never seen this issue. I’m on WP Engine hosting if that matters.

    Here’s how I’m getting the URLs:

    (array)

    $bg = get_sub_field('section_background_image'); 
    $bgurl = $bg['sizes']['large']; 
    echo $bgurl;

    (ID)

    $bgurl = wp_get_attachment_image_src( $bg, 'large' ); 
    echo $bgurl[0];

    Any ideas what might be happening here?

  • I also just tried returning the field as simply the URL (not an array or ID) and the issue exists there as well.

  • Ok, I don’t know how to explain it, but I guess my field got corrupted? I created a new image field with same settings, deleted the old field, and it worked. False alarm!

  • I have the same problem

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.