ACF Get Image snippets

Now that WordPress has Responsive Images as part of core, here’s how to use that power along side Advanced Custom Fields:

A couple of notes

1. Use Image ID as ACF Return Value:


2. I’ve begun escaping the data output from ACF. I thought that since it’s an image url that we’re ultimately after, esc_url would be appropriate according to this Codex article on Validating Sanitizing and Escaping User Data but it doesn’t appear to output anything. Perhaps it’s because the data we’re grabbing is the ID of an attachment…

Leave a Reply

Your email address will not be published. Required fields are marked *

See if Cinch is right for you.

Ask us anything. Seriously. Like, what is the air speed velocity of an unladen swallow?

Start a chat right now

Or go ahead and Sign up now