Title: Function acf_get_attachment is slow
Last modified: September 30, 2026

---

# Function acf_get_attachment is slow

 *  Resolved [QinisoM](https://wordpress.org/support/users/qinisom/)
 * (@qinisom)
 * [1 day, 6 hours ago](https://wordpress.org/support/topic/function-acf_get_attachment-is-slow/)
 * Hi ACF Team.
 * The function above is being reported as slow on my application. Is there any 
   setting to check or tweak I should do to mitigate this issue.
 * Thanks in advance.
 * Kind regards,
 * Qiniso

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Chris Mucheke](https://wordpress.org/support/users/arayachris/)
 * (@arayachris)
 * [1 day, 5 hours ago](https://wordpress.org/support/topic/function-acf_get_attachment-is-slow/#post-19033176)
 * Hi [@qinisom](https://wordpress.org/support/users/qinisom/)
 * ACF Support team here, please note that `acf_get_attachment()` has no setting
   of its own, but a few things drive its cost.
 * For each attachment, ACF fetches the post, the meta, and the alt text. It then
   builds the `sizes` array by calling `wp_get_attachment_image_src()` for every
   registered image size. Themes and page builders often register a dozen or more
   sizes, so one image can trigger a lot of work. Multiply that by a gallery or 
   a repeater with images, and it adds up fast.
 * Things to check, in order of impact:
    1. **Change the field’s Return Format.** Image and Gallery fields set to “Image
       Array” call `acf_get_attachment()` for every image. Switch to “Image ID” and
       render only the size you need with `wp_get_attachment_image()`.
    2. **Use a persistent object cache** (Redis or Memcached). Without one, the post
       and meta lookups hit the database on every page load.
    3. **Trim unused image sizes.** Fewer registered sizes means fewer lookups per 
       attachment. Only remove sizes you’re sure nothing uses.
    4. **Check media offload plugins.** Plugins that filter attachment URLs can add
       extra queries or remote calls to every lookup.
    5. **Profile with Query Monitor.** It shows which calls repeat and how many queries
       each attachment costs.
 * If the function is still slow after checking this, we would love to continue 
   investigating and troubleshooting this issue, please can you create a ticket 
   using our [support form](https://www.advancedcustomfields.com/contact/) and we
   can look into it further.
 *  Thread Starter [QinisoM](https://wordpress.org/support/users/qinisom/)
 * (@qinisom)
 * [1 day ago](https://wordpress.org/support/topic/function-acf_get_attachment-is-slow/#post-19033417)
 * Thanks Chris for the prompt response. I will look into the above.
 * Kind regards,
 * Qiniso

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffunction-acf_get_attachment-is-slow%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/advanced-custom-fields/assets/icon.svg?rev=3207824)
 * [Advanced Custom Fields (ACF®)](https://wordpress.org/plugins/advanced-custom-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields/reviews/)

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)
 * [images](https://wordpress.org/support/topic-tag/images/)

 * 2 replies
 * 2 participants
 * Last reply from: [QinisoM](https://wordpress.org/support/users/qinisom/)
 * Last activity: [1 day ago](https://wordpress.org/support/topic/function-acf_get_attachment-is-slow/#post-19033417)
 * Status: resolved