Changing Your Gravity Forms Field IDs

The easiest way to change your field IDs.

Getting Started

  1. Open the desired form in the Form Editor.
  2. Open your Browser Console

  3. Copy and paste this snippet into the console. Now the gwChangeFieldId() function is available for use on this page.

  4. Provide the current field ID and the new field ID to the gwChangeFieldId() function. Here is an example where current field ID is 4 and the new field is 12

    gwChangeFieldId( 4, 12 );

  5. Click the “Update Form” button to save your changes.


  • currentFieldId (int) (required)

    The current field ID of the field for which you would like to change the ID.

  • newFieldId (int) (required)

    The new field ID to which you would like to set the current field.

Any questions?

We’re always happy to answer questions. How does solution works for you? Why did you need to change your field IDs? Let us know in the comments below!


  1. Keesjan Deelstra
    Keesjan Deelstra May 31, 2022 at 8:01 am

    Hi, amazing solution. Very much needed to alter complex calculation fields and alter som input fields.

    Still think it crazy this is not built in Gravityform UX itself! This is a developer solution, not a regular wp user solution. Any idea if there is a Gravity form add-on for this?

    1. Dario Space
      Dario Space May 31, 2022 at 12:35 pm

      Hi Keesjan,

      Glad it seems useful for you! We are not aware of any add-ons like this currently.


    1. Samuel Bassah
      Samuel Bassah Staff January 31, 2022 at 9:49 am

      Hi Simon,

      We currently do not have a snippet for this. I’ll pass this over to our developers to get their input. If we’re able to come up with a snippet, we’ll let you know by replying to this comment.


    2. David Smith
      David Smith Staff February 1, 2022 at 2:30 pm

      Hey Simon, best way to change a form ID would be do so directly in the database. Do you have access to your site’s database?

  2. TJ
    TJ December 22, 2021 at 9:58 pm

    This is BRILLIANT. I have been wanting a tool for this for a long time!

    I used a bit more geekery: (1) WPCLI and the Gravity Forms CLI plugin to dump my list of 200+ fields (it’s a big form) to a csv file. (2) With the help of a spreadsheet, I generated the “from” and “to” IDs for the function. I copied the whole column into the console all at once. It worked flawlessly.

    For others coming later, be careful to avoid possible field number collisions!

    If your form currently has these field IDs, 8, 2, 5, 3, 6

    you can’t go directly to 1, 2, 3, 4, 5

    8 -> 1 (OK) 2 -> 2 (OK) 5 -> 3 (CONFLICT) 3 -> 4 (OK) 6 -> 5 (OK)

    A workaround: 8 -> 101 (OK) 2 -> 102 (OK) 5 -> 103 (OK) 3 -> 104 (OK) 6 -> 105 (OK)

    If you really want to start at 1, you can repeat it and go from 101 -> 1, 102 -> 2, etc. 101 -> 1 (OK) 102 -> 2 (OK) 103 -> 3 (OK) 104 -> 4 (OK) 105 -> 5 (OK)

    Thanks again for the great tool.


  3. Charles
    Charles June 18, 2021 at 5:34 pm

    Having some trouble getting this to work…it looks from the video like maybe the form editor has changed? When I paste the snippet into console and then enter the parameters, I get the message “ReferenceError: form is not defined”

    1. Samuel Bassah
      Samuel Bassah Staff June 21, 2021 at 12:24 pm

      Hi Charles,

      I just tested the snippet again, and it works as expected. Can you confirm if you’re running the code on the Form Editor page?


  4. Javier
    Javier May 13, 2021 at 7:29 am

    Not working for me neither :S

    It says: VM4599:1 Uncaught ReferenceError: gwChangeFieldId is not defined at :1:1

    1. Samuel Bassah
      Samuel Bassah Staff May 13, 2021 at 7:40 am

      Hi Javier,

      I just tested this on my end with GF 2.5.1 and it works as expected. Please note that you will have to first copy, paste and run the snippet in the browser console, before calling the function with the ID parameters. In case you’re still having issues with it, you can pick up a Gravity Perks license and get in touch with us via our Support form, so we can dig into this further.


  5. Paul Biron
    Paul Biron October 19, 2020 at 12:28 pm

    If the new field ID is larger than form.nextFieldId then you should also update form.nextFieldId to one greater than the new field ID, or else you might have problems when fields are later added to the form.

  6. Arvind
    Arvind July 6, 2020 at 6:56 am

    Wow. Cool. A huge time saver when creating bulk gravity forms. Helps a lot when you have to create similar forms many times over in different contexts Gravity forms plugin with gravity perks plugins is now a must have for any wordpress based software now. No other plugin comes even close. thanks.

    1. Ryan Donovan
      Ryan Donovan July 6, 2020 at 10:01 am

      Hey Arvind, Thank you so much for the kind words. We hope you continue to enjoy all our awesome snippets and perks. πŸ˜ƒ

    1. Ryan Donovan
      Ryan Donovan May 12, 2020 at 9:53 am

      Hello Crystal, Thank you for that informtion. I have updated the page so the video should be working correctly now. Have a great day! πŸ˜ƒ

  7. Avi Spiegel
    Avi Spiegel November 19, 2019 at 12:12 pm

    This does not maintain the conditional logic for the questions. Ie if you have it set to show/hide a question based on ID30, and you change that to field ID50, then the conditional logic will break.

    It might be a better idea to build this into a perk so you can account for all these conditions and edge-cases.

    1. David Smith
      David Smith Staff December 17, 2019 at 11:43 am

      Hi Avi, thanks for the feedback. We don’t have plans to make this into a more robust tool but we’ll continue to track customer demand for such a tool.

  8. Andre Nell
    Andre Nell September 2, 2019 at 6:39 pm

    I am curious if there is a way to pass in an array with fields to be changed. This is what I tried.

    I created a php file with the following code:

    I then opened the form editor, and opened the Firefox Console.

    I then passed in an array of field ids to change (pasted this in the console):

    I then pasted your function in the console.

    Finally, I pasted the following function call in the console:

    So far, not successful.

    1. Avi Spiegel
      Avi Spiegel November 19, 2019 at 11:47 am

      Just FYI, the array works but you have to be careful because it doesn’t have the built in success/fail of the GW function. So this array could possibly end up deleting your fields. What happens is this, you change Field ID 30 and there’s already a #30 in your form, this function will now delete the original and duplicate it into the original 30, leaving you with two #30. I know I’m probably not explaining it right but just be careful of something like the following:

      my items = [ [1,30], [30,17] ]; in this example you have two fields, one with ID1 and another with ID30. What you may be expecting is that you change ID1 into ID30 and ID30 into ID17 but since it processes in order you end up with two ID17 that are duplicates of one another and the original ID1 is deleted.

  9. Ben
    Ben May 15, 2019 at 10:03 am


    This sounds great, I’ve set up a massive amount of conditional pricing, I’ve realized I’ve set up a checkbox list that should have been radial! Can I delete the check boxes and create a radial field, make the choices identical in the same order and then set the field Id to the original number of the checkbox? Do you think it will work or will all my conditional pricing break? It’s taken ages to implement!



  10. Richard
    Richard November 4, 2018 at 3:59 am

    Do we need to change ID to another number or can we give it a custom name? I tried to watch the video, but it does not appear to be working. I’m trying to give field IDs a custom name. Any help appreciated.

  11. Jason
    Jason November 3, 2018 at 3:50 pm

    This is an excellent little snippet. Still can’t believe after all this time GF hasn’t given us the ability to provide custom ID and Name attributes.

    Any chance you have a solution for changing the FORM ID rather than the field ID? Same annoyance. I’ll pay you ;)

    Thank you David!

    1. David Smith
      David Smith Staff November 8, 2018 at 3:17 pm

      Hi Jason, easiest solution would be to log into the database and modify it there (gf_form, gf_form_meta, gf_form_view). We don’t have a snippet for this one. If you’re looking to hire someone to create a more polished solution, is a great resource. ?

  12. ronen
    ronen October 2, 2018 at 6:16 am

    Hi, When I paste the gwChangeFieldId( 4, 12 ) into the console and press enter I get this: Uncaught ReferenceError: gwChangeFieldId is not defined at :1:1 and after I save the form noting happens. Thanks, Ronen

  13. Robert
    Robert February 20, 2018 at 4:31 am

    Hi, so I am not sure how to do this.. I paste the code in the console, but where do I have to change the field id? gwChangeFieldId(), Where is this exactly? I can see at the beginning: gwChangeFieldId = function( currentId, newId ) {

    Do I need to replace the numbers in currentId and newId in all code?

    Please help

  14. TJ Sherrill
    TJ Sherrill January 8, 2018 at 9:52 pm

    Just a note, if you are using the repeater plugin, you have to get your field out of the repeater before this will work.

  15. Jo
    Jo June 5, 2017 at 12:27 pm

    Not sure if I’m doing something wrong or not but I added this to the console and it told me it worked but upon saving, nothing changed. I’m wondering if an update this year changed this from working.

    1. David Smith
      David Smith Staff June 6, 2017 at 8:06 pm

      Hm, hard to say, Jo. I confirmed that this is still working on my end. If you need help with this and would like hands-on support, pick up a copy of Gravity Perks which includes complimentary support for our snippets.

  16. Joe Trusty
    Joe Trusty February 2, 2017 at 4:24 pm

    Nice! Was looking for an easy way to do this rather than create a field array to rgar from. Bing bang boom – 2 seconds, done!

  17. Jiri
    Jiri October 4, 2016 at 2:27 pm

    Hi, if I put the snippet in console and then call the function then i get following error:

    gwChangeFieldId( 60, 100 ); ReferenceError: form is not defined [Learn More]

    What do I do wrong? Browser Firefox 49.0.1

    Thanks for any help!

    1. David Smith
      David Smith Staff October 6, 2016 at 9:48 pm

      Only thing I can think is that in your console, you’re not working with the “top” level document. Here’s what that looks like in Chrome (screenshot).

  18. Bryan Assata
    Bryan Assata June 27, 2016 at 8:25 am

    I am getting an “Uncaught ReferenceError: gwChangeFieldID is not defined. I had posted last week, but don’t see my original post. You had wanted me to export my form and send it…..where can I send that to?

  19. AJ
    AJ April 22, 2016 at 9:09 pm


    Thanks for this snippet. I’m running to a problem when changing an address field id. The id does get changed, however, it doesn’t let you open the field box to show the advanced settings.

    1. David Smith
      David Smith Staff April 23, 2016 at 3:47 pm

      Could you send me an export of the form you’re trying to change the Address field ID on?

    2. AJ
      AJ April 23, 2016 at 11:30 pm

      Thanks David. Unfortunately, I’m unable to export the form because there is excessive customization. However, I was able to get it to work by changing the values manually.

      The error message I was getting from the console log was: Uncaught TypeError: form.fields[i].inputs[j].id.replace is not a function(…)

      When I created a brand new form, and tried to change to field id on an address field, the code worked perfectly. So, there might have been something wrong with my particular form.

      The way I changed the values manually was basically following the format of the code:

      1. Right Click on the Field and Select Inspect this Element. Then Change the Field Id of the li list.

      – example to 2. Then Open the console and type in “console.log(form);” to get the form array values. 3. Find the Fields Objects. and find the field that I wanted to change and change the id. 3. Then go to the Inputs Objects under the same Field Object. And Change the ID of the Input values. The ID of the Input values where changed from 1.1, 1.2, 1.3, etc. to 4.1,4.2,4.3 etc.

      Lastly, close the console and update the form. And It should work.

      I appreciate you trying to help though. If I run to anymore trouble, I’ll keep in contact.

      Thanks Again

  20. Rod Salm
    Rod Salm February 17, 2016 at 9:56 pm

    Hi there,

    This works, but do you know of a way to reset all the fields of a form? Basically to start over? Any new field I add is setting the ID’s in the 77000’s which is causing problems on the back end entries and output to pdf.

    1. David Smith
      David Smith Staff September 19, 2015 at 7:36 pm

      Hi Rod, at the top of the article is a “show snippet” button (it’s purple). If you click that, it will reveal the snippet).

Leave a Reply

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

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Download Snippet

Changing Your Gravity Forms Field IDs

This field is for validation purposes and should be left unchanged.