Docs

Advanced Custom Fields

3 min readUpdated June 28, 2026

Advanced Custom Fields (ACF) stores attachment IDs in postmeta and retrieves file URLs through WordPress’s standard attachment functions. WP Media Cloud filters those functions to return cloud storage URLs, so ACF image, file, and gallery fields resolve to CDN URLs automatically with no configuration required. WP Media Cloud also includes a small fix for ACF’s filesize display when local files have been removed.

How they work together#

ACF image, file, and gallery fields store the WordPress attachment ID — not the URL — in postmeta. When ACF retrieves a field value to display on the front end, it calls WordPress’s attachment URL functions to resolve the ID to a URL. WP Media Cloud filters those functions at the point of output and returns the cloud storage or CDN URL. No changes to your ACF field groups, field types, or templates are needed.

This applies to all contexts where ACF field values are output:

  • Custom post types, pages, and posts
  • Taxonomy terms
  • User profiles
  • Options pages
  • Repeater and flexible content fields containing image or file sub-fields

Filesize display with local file removal#

ACF’s acf_get_attachment() function includes a filesize key in its response. When local files have been removed after offloading, ACF’s default behaviour is to check whether the file exists on the local filesystem to determine its size. If the local copy is gone, the check returns false and ACF displays a filesize of zero.

WP Media Cloud hooks into ACF’s acf/filesize filter (available in ACF 6.2.2 and later) and returns the filesize from WordPress attachment metadata instead, avoiding the local filesystem check and showing the correct value. This only applies to files that have been offloaded by WP Media Cloud.

If you are using ACF older than 6.2.2, the filesize filter is not available and the filesize may display as zero for offloaded files with local copies removed. Updating ACF resolves this.

Configuration#

No configuration is required. WP Media Cloud detects ACF automatically, initialises the filesize filter, and reports ACF’s status on the Integrations tab.

Which field types are affected#

Fields that store a media library attachment ID are served from cloud storage automatically:

  • Image field
  • File field
  • Gallery field
  • Image and file sub-fields inside Repeater fields
  • Image and file sub-fields inside Flexible Content fields

Fields that store plain text, numbers, dates, colours, post relationships, taxonomy terms, or other non-media values are not affected. WP Media Cloud only intercepts WordPress attachment URL functions — it does not touch any other data type.

Troubleshooting#

ACF image field is showing the local URL instead of the cloud URL
Confirm that URL rewriting is enabled in WP Media Cloud > Settings. Also confirm the image has been offloaded — go to Media > Library, click the image, and check its URL. If it shows the local site URL the file has not been offloaded. Run the bulk migration tool to offload existing media.

Filesize shows as zero in ACF field data
If ACF is older than version 6.2.2, the acf/filesize filter used by WP Media Cloud is not available. Update ACF to 6.2.2 or later to resolve this. If ACF is already up to date and filesize still shows as zero, the file’s size may not be stored in WordPress attachment metadata — this is normal for older uploads that predate WordPress’s filesize storage in metadata.

Gallery field images not loading
Gallery fields store an array of attachment IDs. WP Media Cloud rewrites each ID’s URL individually via WordPress attachment functions. If some gallery images are not loading, confirm each image in the gallery has been offloaded by checking it individually in the media library.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only