Home › Forums › ACF PRO › Image not saving as URL › Reply To: Image not saving as URL
Well, I have it working, but not the way I’d like it to, and there is still a bug in ACF Pro (current version).
The only way I can get it to work is to change how the image is stored to as an ID.
The bug is that regardless of how I select it to be stored (my preference would be as a URL), it stores it as an ID anyway – so changing it to Array or URL has no effect – it still just shows up in the database with an ID number.
BUT regardless of how it is stored, unless I change that setting to *also* be “ID” then I can’t use it using the get_field function.
The ONLY way I can get it to work is to have it set to store as an ID and use the echo wp_get_attachment_image( $imgID, $size ); method, which is not ideal because then WP adds classes and styling that I don’t want and have to override with my own styles, and I am limited to the WP image sizes (although I know I can add my own and have, but in some places I just want to add a one-off image size without having to put it in my functions first) .
If I could just echo the URL, I can structure my own image link using my own sizes and styles and pull in whatever other author meta I want….
Any help would still be welcomed, ideally I’d like to see the bug fixed in a future update – if the option exists to store images as an array or as a URL, it should save to the database using the selected option.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.