Advanced Custom Fields
This page explains how WP Media Cloud works with Advanced Custom Fields (ACF). Image, File and Gallery fields serve CDN URLs with no setup, and WP Media Cloud fixes the file size ACF reports for offloaded files.
What the integration does#

ACF Image, File and Gallery fields store attachment IDs. When ACF outputs a field, it turns each ID into a URL with standard WordPress attachment functions. WP Media Cloud filters those functions at priority 99 and returns the CDN URL for every offloaded file.
This happens on the fly as pages load. Nothing in your field data is changed. It applies wherever ACF outputs these fields, including Repeater and Flexible Content sub-fields and options pages.
The integration adds one hook of its own:
| Hook | What it fixes |
|---|---|
acf/filesize | ACF reads the file size from the server. Once local copies are removed, that check finds no file and ACF reports 0. WP Media Cloud returns the size saved in the attachment metadata instead. |
The file size fix only applies to files WP Media Cloud has offloaded. It needs ACF 6.2.2 or newer, the version that added the acf/filesize filter. If an older upload has no size in its metadata, the value stays 0.
What you need to switch on#
There is no ACF setting in WP Media Cloud. Check these:
- Go to Media Cloud > Settings and make sure Rewrite URLs is on.
- Offload your existing media with Offload All Media in the Dashboard Bulk Offload card. Fields only get CDN URLs for files that are offloaded.
- Open Media Cloud > Integrations. The Advanced Custom Fields card shows Active and the ACF version. This status can take up to 5 minutes to update after you activate ACF.
Limits#
- Only attachment-based fields are rewritten by ID. Text, URL, Link and other fields that store a typed URL keep the URL you saved.
- WYSIWYG fields are not passed through
the_content. ACF formats them with its ownacf_the_contentfilter. WP Media Cloud’s content rewriting runs onthe_content, so image URLs typed into a WYSIWYG field are not rewritten on the fly. Use URL Replace for these. - Fields shown through
the_content. If your theme prints field HTML inside post content, the content rewriting does catch those URLs.
URL Replace (beta)#
ID-based fields (Image, File, Gallery) do not need URL Replace. For URLs stored as text, such as WYSIWYG or URL fields, run URL Replace (beta) from Media Cloud > Migration.
URL Replace scans wp_posts, wp_postmeta and wp_options. That covers ACF fields on posts and options pages. It does not scan wp_termmeta or wp_usermeta, so URLs typed into fields on taxonomy terms or user profiles are not changed. Back up your database first. Revert selected to local URLs undoes the change.
Troubleshooting#
| What you see | What it means | How to fix it |
|---|---|---|
| An Image field shows a local URL | Rewrite URLs is off, or the file is not offloaded | Turn on Rewrite URLs, then run Offload All Media |
| Some Gallery images are local | Each image is rewritten on its own, and some are not offloaded yet | Offload the missing images, or check the Dashboard Bulk Offload card for failed items |
File size shows 0 | ACF is older than 6.2.2, or the upload has no size in its metadata | Update ACF |
| Images in a WYSIWYG field are local | ACF does not run WYSIWYG output through the_content | Run URL Replace (beta) |