Title: ACF File field returning integer instead of array
Last modified: October 10, 2023

---

# ACF File field returning integer instead of array

 *  [ncj](https://wordpress.org/support/users/ncj/)
 * (@ncj)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/acf-file-field-returning-integer-instead-of-array/)
 * I’m using the plugin on a custom post type that uses ACF fields. For one particular
   field, a “File” field, the template is set up to render a file array, which it
   does correctly when viewing a published post. However, when viewing the same 
   page a Post Draft Preview URL, it returns an integer (the file ID). Any suggestions?
 * Here’s the code in the template:
 * `$file = get_field('pdf');`
   `$url = $file['url'];$title = $file['title'];echo
   esc_attr($url);echo esc_html($title);

The topic ‘ACF File field returning integer instead of array’ is closed to new replies.

 * ![](https://ps.w.org/post-draft-preview/assets/icon.svg?rev=2929131)
 * [Post Draft Preview](https://wordpress.org/plugins/post-draft-preview/)
 * [Support Threads](https://wordpress.org/support/plugin/post-draft-preview/)
 * [Active Topics](https://wordpress.org/support/plugin/post-draft-preview/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-draft-preview/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-draft-preview/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [ncj](https://wordpress.org/support/users/ncj/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/acf-file-field-returning-integer-instead-of-array/)
 * Status: not resolved