Using the Gravity Forms + Custom Post Types WordPress plugin to map your Gravity-Forms-generated posts to a custom post type is very handy, but I noticed that it doesn’t seem to work with file uploads. This is because by default, Gravity Forms saves files to /wp-content/uploads/gravity_forms and stores their URLs. ACF on the other hand, saves files to the WP Media Library and stores their attachment IDs. The methods in the class below can be used to solve problem this by doing the following:

  • After the form has been submitted, get the file from the GF uploads directory and insert it into the WordPress Media Library.
  • Update the post to save the attachment ID in the ACF form field, so ACF knows where to look for it.
  • Delete the original file that was uploaded to the GF uploads directory.

Be sure to change line 48 to reflect the name of your Gravity Form, and lines 56 & 57 to reflect the Gravity Forms an ACF field IDs that you want to map to one another.


  1. Fabio infante December 16, 2016 at 8:43 pm


    Hi kellen, thanks for share, I want to upload multiple files for several custom fields at the same time on the same form

  2. Tiffany Israel April 4, 2017 at 11:07 am


    Is there a way to get this to work with out a post submission? Also for line 48 is this just the title of the Gravity forms, no special “nicename” or anything?

Leave a reply

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