GravityKit icon

Black Friday Pro

Take 25% off GravityView Pro, All Access, and Lifetime with code BFPRO25.

Shop the Sale
Skip to content
GravityKit
Buy
Sign in
0 items
  • Plugins

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
    • GravityView Pro

      GravityView Pro

      Bestseller

      Get Live Filters, Maps, DataTables, the Advanced Elementor Widget and every other Pro feature to build the app your process needs.

    • GravityView

      GravityView

      Trending

      Display Gravity Forms entries on the frontend of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, PDF, or Google Sheets, then share them with secure links or deliver them to cloud storage on a schedule.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data between sites, including forms, entries, settings, Views, feeds, and file uploads, and import forms from other form plugins.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    • GravitySearch

      GravitySearch

      Search Gravity Forms entries across every form from one screen.

  • Ideal For

    • Nonprofits
    • Web Agencies
    • Education
    • Developers
    • Small Businesses
    • Startups
    Explore All Use Cases

    Case studies

    • Be There Local
    • Killer Shorts
    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    View All Case Studies
  • Resources

    • Blog
    • Case studies
    • Newsletter
    • GravityKit vs competitors
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy

    Ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Support
  • Pricing
  • Plugins

    • GravityView Pro

      GravityView Pro

      Bestseller

      Get Live Filters, Maps, DataTables, the Advanced Elementor Widget and every other Pro feature to build the app your process needs.

    • GravityView

      GravityView

      Trending

      Display Gravity Forms entries on the frontend of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, PDF, or Google Sheets, then share them with secure links or deliver them to cloud storage on a schedule.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data between sites, including forms, entries, settings, Views, feeds, and file uploads, and import forms from other form plugins.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    • GravitySearch

      GravitySearch

      Search Gravity Forms entries across every form from one screen.

    View All Products

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
  • Ideal For

    • Nonprofits
    • Web Agencies
    • Education
    • Developers
    • Small Businesses
    • Startups
    Explore All Use Cases

    Case studies

    • Be There Local
    • Killer Shorts
    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    View All Case Studies

    How to build...

    • Client Portal
    • AI-Built Directory
    • Conference Website
    • WordPress CRM
    • Admin Dashboard
    • Inventory Management
    • Vendor Portal
    • Document Library
    View All Guides
  • Resources

    • Blog
    • Case studies
    • Newsletter
    • GravityKit vs competitors
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy

    ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Support
  • Pricing
0 items

Search

Results appear automatically as you type.
Loading results…

results found matching

    Sign in
    Buy

    Docs

    • Docs Home

    Gravity Forms Add-Ons

    • GravityView
    • GravityActions
    • GravityBoard
    • GravityCalendar
    • GravityCharts
    • GravityEdit
    • GravityExport
    • GravityImport
    • GravityMath
    • GravityRevisions
    • GravitySearch
    • GF Widget for Elementor
    • GF Dynamic Lookup
    • GF Entry Tags
    • GF Event Field
    • GravityExport Lite
    • GF Zero Spam
    • GravityMigrate

    GravityView

    • Getting Started
    • View Setup
    • FAQ
    • Pre-Sale
    • Advanced
    • Common Problems
    • Customizing Your Views
    • Edit Entry
    • Entry Approval
    • Filter and Sort Results
    • Gravity Forms
    • Merge Tags
    • Roles and Capabilities
    • Search
    • Shortcodes
    • View Settings
    • WordPress Posts

    General Help

    • Account, Invoices, and Billing
    • License Related
    • Plugins and Settings
    • Agency accounts
    • Contact
    • Docs Home
    • Gravity Forms Add-Ons

      • GravityView
      • GravityActions
      • GravityBoard
      • GravityCalendar
      • GravityCharts
      • GravityEdit
      • GravityExport
      • GravityImport
      • GravityMath
      • GravityRevisions
      • GravitySearch
      • GF Widget for Elementor
      • GF Dynamic Lookup
      • GF Entry Tags
      • GF Event Field
      • GravityExport Lite
      • GF Zero Spam
      • GravityMigrate
    • GravityView

      • Getting Started
      • View Setup
      • FAQ
      • Pre-Sale
      • Advanced
      • Common Problems
      • Customizing Your Views
      • Edit Entry
      • Entry Approval
      • Filter and Sort Results
      • Gravity Forms
      • Merge Tags
      • Roles and Capabilities
      • Search
      • Shortcodes
      • View Settings
      • WordPress Posts
    • General Help

      • Account, Invoices, and Billing
      • License Related
      • Plugins and Settings
      • Agency accounts
    • Contact

    GravityMigrate

    • Migrating a large site
    • Migrating between Contact Form 7 and Gravity Forms
    • Migrating between Fluent Forms and Gravity Forms
    • Migrating between Formidable Forms and Gravity Forms
    • Migrating between Forminator and Gravity Forms
    • Migrating between Ninja Forms and Gravity Forms
    • Migrating between WPForms and Gravity Forms
    • Migrating between WS Form and Gravity Forms
    • Migrating forms from another form plugin
    • Migrating forms that use Gravity Perks
    • Migrating forms with AI using the GravityKit MCP
    • Migrating Gravity Forms from the command line with WP-CLI
    • What changes when you import
    • Where uploaded files go during a migration
    • Which feeds and add-ons migrate
    • Which fields migrate between Gravity Forms and each form plugin
    • Best practices for moving data with GravityMigrate
    • Getting started with GravityMigrate
    • GravityMigrate hooks
    • How does GravityMigrate handle nested forms?
    • Migrating Zapier feeds
    • Home
    • Docs
    • GravityMigrate
    • Migrating Gravity Forms from the command line with WP-CLI

    Migrating Gravity Forms from the command line with WP-CLI

    Estimated reading: 14 minutes

    Updated on November 25, 2026

    GravityMigrate adds wp gk migrate commands to WP-CLI. With them you can export and import a migration file from a terminal, script a move between two servers over SSH, or migrate a site that’s too large to finish in the browser. The commands make and read the same migration file as the GravityMigrate screen in the dashboard, so a file exported on one side imports on the other.

    Before you begin #

    • WP-CLI on the server you run the commands on, as Installing WP-CLI describes.
    • GravityMigrate active on both sites.
    • An administrator’s login. Every wp gk migrate command needs --user=<administrator login>, and without it the command stops with “Run with --user=<an administrator login>” and the reason. The examples below use --user=admin.

    Quick start #

    Export from the old site, copy the file across, and import it on the new site:

    # On the old site
    wp gk migrate export --user=admin --forms=all --output=/tmp/migration.zip
    
    # On the new site, after copying the file there
    wp gk migrate import /tmp/migration.zip --user=admin --yes

    Without --data, the export holds entries, Views and the pages that embed your forms or Views. Add the other kinds of data you need with --data, as the next section shows.

    Exporting a migration file #

    wp gk migrate export writes the forms and data you choose into a ZIP file.

    # Forms 3 and 5 with their entries, Views and pages
    wp gk migrate export --user=admin --forms=3,5 --data=entries,views,posts --output=/srv/backups/forms.zip
    
    # Every form, with entries submitted in the first half of 2026
    wp gk migrate export --user=admin --forms=all --data=entries --date-start=2026-01-01 --date-end=2026-06-30 --output=/tmp/first-half.zip
    
    # Encrypt the file with a password
    wp gk migrate export --user=admin --forms=all --password="a-strong-password" --output=/tmp/secure.zip
    
    # Put the uploaded files inside the file
    wp gk migrate export --user=admin --forms=all --include-files --output=/tmp/standalone.zip
    OptionWhat it does
    --forms=<ids>Required. Comma-separated form IDs, or all. Here all includes inactive forms and forms in the trash.
    --data=<types>Comma-separated data types, or all. Without it: entries,views,posts. The types are listed under Data types.
    --date-start=<Y-m-d>,
    --date-end=<Y-m-d>
    Export only the entries submitted on or after the start date and on or before the end date.
    --password=<password>Encrypt the file. Inspecting or importing it then needs the same password.
    --include-filesPut the files uploaded with the entries inside the migration file, so the new site doesn’t download them from this one. Use it when this site can’t be reached from the new one, or is about to be switched off. The file gets larger. The files inside can add up to 80% of this site’s upload limit, newest first, and the rest are still downloaded from this site during the import. Adds uploads and entries to --data.
    --public-url=<url>Replace this site’s address with <url> in the content of its pages and in the links of File Upload fields that take one file, so the new site downloads those files from an address it can reach. Use it when the address this site stores, such as a local or staging address, isn’t reachable from the new site. When every uploaded file has to come across, use --include-files.
    --output=<path>Copy the finished file to this path. Without it, the file stays in wp-content/uploads/gk-migrate-exports/, which is cleared after three hours.
    --porcelainPrint only the path of the file.
    --format=<format>Print the summary as table (the default) or json.

    When you export a form that uses GP Nested Forms, list the child form’s ID in --forms with its parent’s. The command line doesn’t add child forms on its own, as the GravityMigrate screen does, and a parent imported without its child form arrives without its child entries. How does GravityMigrate handle nested forms? has the details.

    Importing a migration file #

    wp gk migrate import reads a migration file and adds its forms, entries, Views and other data to the current site, as new forms with new IDs.

    # Import everything in the file
    wp gk migrate import /tmp/migration.zip --user=admin --yes
    
    # Import only some of the forms and data
    wp gk migrate import /tmp/migration.zip --user=admin --forms=3,5 --data=entries,views --yes
    
    # Import a file that has a password
    wp gk migrate import /tmp/secure.zip --user=admin --password="a-strong-password" --yes
    
    # Import without downloading the uploaded files
    wp gk migrate import /tmp/migration.zip --user=admin --skip-uploads --yes
    OptionWhat it does
    <zip>The path to the migration file. Required.
    --forms=<ids>The command imports only these forms, named by the IDs they had on the old site. The default is all. An ID that isn’t in the file stops the command with “Form <id> is not in this bundle”.
    --data=<types>The data types to import, or all (the default). Only types the file holds are imported.
    --password=<password>The file’s password. A missing or wrong one stops the command with “The import bundle could not be decrypted.”
    --skip-uploadsDon’t download the uploaded files. The imported entries keep linking to the files on the old site.
    --yesImport without asking first. Without it, the command asks “This writes forms, entries, and Views into this site. Continue? [y/n]”, and when nobody answers, as in a script, it imports nothing and still exits with 0.
    --porcelainPrint only the IDs of the new forms, one per line.
    --format=<format>Print the summary as table (the default) or json, with the new form IDs, the number of entries, and the uploaded files downloaded and failed.
    --download-timeout=<secs>,
    --max-download-bytes=<n>,
    --max-dump-file-size=<n>
    Raise or lower the import’s limits for this run: 300 seconds and 100 MB for each uploaded file it downloads, and 2 GB for the database dump in the file.

    With --data=all, or without --data, an import also brings any settings the file holds. Gravity Forms Settings and GravityKit Settings then replace this site’s own settings, license keys and API credentials included, and the command doesn’t ask about them the way the GravityMigrate screen does. To leave them out, name the other types in --data.

    Inspecting a file before importing #

    wp gk migrate inspect shows what a migration file holds without importing it. It names the site the file came from, its forms and data types, and whether the uploaded files are inside it.

    wp gk migrate inspect /tmp/migration.zip --user=admin
    
    # As JSON, for a script
    wp gk migrate inspect /tmp/migration.zip --user=admin --format=json

    Add --password=<password> for a file that has one. src_url_public says whether the address the file came from is public. For a local or private address it reads NO (private/SSRF-blocked: uploads will not download), and a warning suggests exporting again with --public-url. A public address doesn’t prove the new server can reach it.

    Checking migration state #

    wp gk migrate status reports whether an import is running, whether an earlier import crashed, and whether an export left files to clean up. While an import runs, it also shows the phase it’s in, such as “Importing entries”, and how many of the phase’s steps are done. An estimate of the seconds left and the seconds since the last step come with it.

    wp gk migrate status --user=admin
    wp gk migrate status --user=admin --format=json
    
    # Follow a running import until it finishes
    wp gk migrate status --user=admin --watch

    --watch redraws the status every two seconds until the import finishes, and can’t be combined with --format=json. To follow an import from a script, run status --format=json in your own loop.

    Clearing stuck migration state #

    When an import was interrupted, the next one can stop with “Import already in progress”. Check with wp gk migrate status --user=admin that nothing is still running. Then clear what the interrupted import left behind: its temporary tables, the unpacked file and the progress records.

    wp gk migrate reset --user=admin --yes

    Migrating forms to or from another form plugin #

    The command line also runs the migration between Gravity Forms and another form plugin on the same site. The to command copies Gravity Forms forms into the other plugin, and from recreates the other plugin’s forms in Gravity Forms. Both need an administrator, and they work only while the other plugin is active.

    Migrating forms from another form plugin explains what comes across and how to read the report.

    First, list the plugins this site can migrate to or from:

    wp gk migrate plugins --user=admin
    wp gk migrate plugins --user=admin --available --format=ids

    The list names each plugin’s slug, whether it can be a destination (to) or a source (from), and why not when it can’t. The slugs are contact-form-7, fluent-forms, formidable-forms, forminator, ninja-forms, wpforms and ws-form. --available keeps only the plugins this site can use. Then:

    # See what would happen to each field of form 3 in Fluent Forms, and change nothing
    wp gk migrate to fluent-forms --user=admin --forms=3 --dry-run
    
    # The same check, printing only the IDs of the forms checked
    wp gk migrate to fluent-forms --user=admin --forms=3 --dry-run --format=ids

    Without --dry-run, the command creates the forms in the other plugin, or in Gravity Forms with from.

    OptionWhat it does
    <plugin>The other plugin’s slug, as wp gk migrate plugins lists it.
    --forms=<ids>Required. Comma-separated form IDs, or all. With to, the IDs are Gravity Forms form IDs, and all means every active form that isn’t in the trash. With from, they are the other plugin’s own form IDs, and all means every form it lists.
    --dry-runPrint what happens to each field, with the warnings, and change nothing.
    --yesRun without asking first. A run that creates forms needs it with every --format except table. A --dry-run doesn’t.
    --format=<format>table (default), json, count or ids. After a run, count and ids cover the forms that were created, and json lists every form with any failure. With --dry-run, they cover the forms that were checked, and nothing is created.

    GravityMigrate prints each form’s warnings after the field report.

    Data types #

    --data takes a comma-separated list of these types, or all:

    TypeWhat it holds
    entriesThe forms’ entries, with their notes and other entry data.
    uploadsThe files uploaded with the entries. Adds entries.
    viewsGravityView Views built on the forms.
    postsThe pages and posts that embed the forms or Views.
    revisionsForm revisions.
    addon_feedsThe add-on feeds attached to the forms. Which feeds and add-ons migrate covers what else each add-on needs.
    gravityflowGravity Flow history, where the site has it.
    draftsEntries saved to finish later.
    gf_settingsA set list of Gravity Forms settings.
    gk_settingsGravityKit settings, GravityView’s included.
    rest_api_keysGravity Forms REST API keys.

    all includes the last three, which can hold license keys and API credentials. The GravityMigrate screen leaves them off unless you tick them. An export skips a type whose table doesn’t exist on the site, with a warning such as “Skipping data type ‘gravityflow’: its Gravity Forms table does not exist on this site.”

    Output and exit codes #

    A command that works exits with 0. When a command stops, it prints “Error:” with the reason and exits with 1, so set -e in a shell script stops at the first failure. Warnings print as “Warning:” lines and don’t change the exit code.

    A to or from run where some forms fail and others work also exits with 0. In a script, read the result too, for example the failure that --format=json lists for each form.

    In a script, use export --porcelain, which prints only the file’s path, and import --porcelain, which prints only the new form IDs. export, import, inspect and status also print their summary as JSON with --format=json.

    Scripting a migration between two servers #

    A script can export, copy the file across and import it in one run:

    #!/bin/bash
    set -e
    
    # Export on this site and keep the path of the file
    ZIP=$(wp gk migrate export --user=admin --forms=all --porcelain)
    
    # Copy it to the new server and import it there
    scp "$ZIP" deploy@destination:/tmp/migration.zip
    ssh deploy@destination "wp gk migrate import /tmp/migration.zip --user=admin --yes --porcelain"

    Troubleshooting #

    • “‘gk’ is not a registered wp command” or “‘migrate’ is not a registered subcommand of ‘gk'”: GravityMigrate isn’t active on the site the command runs on. Activate it, and on a multisite network add --url=<site address> for the right site.
    • “Run with --user=<an administrator login>”: add --user= with an administrator’s login or user ID.
    • “Import already in progress”: an earlier import still holds its lock. Run wp gk migrate status --user=admin. If nothing is running, run wp gk migrate reset --user=admin --yes and import again.
    • The uploaded files didn’t come across: the import ran with --skip-uploads, a file was over the download limits (--max-download-bytes, --download-timeout), or the new site couldn’t reach the old site’s address. Files past the 80% that --include-files packs are downloaded too, so they need that address as well. Check the file with wp gk migrate inspect, then export again with --include-files.
    • “The import bundle contains a file whose uncompressed size exceeds the maximum allowed size and was rejected.”: the database dump in the file is larger than the import allows. wp gk migrate inspect shows its size in dump_size_bytes. Raise the limit for one run with --max-dump-file-size=<bytes>.

    Related articles #

    • Getting started with GravityMigrate
    • Migrating a large site
    • GravityMigrate hooks
    • Firewall or WAF blocking GravityKit imports and exports
    Still stuck? How can we help?

    How can we help?

    "*" indicates required fields

    This field is for validation purposes and should be left unchanged.
    Replies will go to this email.
    How can we help?*
    My pre-sale question is related to...*
    My WordPress skills are....*
    My Gravity Forms skills are...*
    You will be shown articles from our documentation.
    Vous pouvez nous écrire dans votre langue maternelle si c’est plus facile pour vous—nous nous occuperons de la traduction!
    Puedes escribirnos en tu idioma nativo si te resulta más fácil; ¡nosotros nos encargamos de la traducción!
    Sie können uns in Ihrer Muttersprache schreiben, wenn das für Sie einfacher ist – wir kümmern uns um die Übersetzung!
    U kunt ons in uw moedertaal schrijven als dat gemakkelijker voor u is — wij zorgen voor de vertaling!
    Du kan skrive til oss på ditt morsmål hvis det er enklere for deg — vi tar oss av oversettelsen!
    Du kan skriva till oss på ditt modersmål om det är lättare för dig — vi tar hand om översättningen!
    Você pode nos escrever em seu idioma nativo se for mais fácil para você — nós cuidaremos da tradução!
    Puoi scriverci nella tua lingua madre se ti è più facile — penseremo noi alla traduzione!
    Please provide as much detail as you're able; this helps us provide you with faster support.
    Drop files here or
    Accepted file types: jpg, jpeg, gif, png, tiff, pdf, bmp, zip, json, csv, xls, xlsx, Max. file size: 256 MB.
      Get better at Gravity Forms every Friday

      Was this page helpful?

      Table Of Contents
      • Before you begin
      • Quick start
      • Exporting a migration file
      • Importing a migration file
      • Inspecting a file before importing
      • Checking migration state
      • Clearing stuck migration state
      • Migrating forms to or from another form plugin
      • Data types
      • Output and exit codes
      • Scripting a migration between two servers
      • Troubleshooting
      • Related articles
      GravityKit
      • How to Build It
      • GravityKit vs competitors
      • Pricing
      • Products
      • Our Team
      • Our Values
      • Work With Us
      • Partner Directory
      • Coupons
      Support
      • Support
      • Contact
      • Documentation
      • Scope of Support
      • Brand Guidelines
      • Brand Kit
      • Privacy Policy
      • Terms of Service (“Terms”)
      I am a...
      • Nonprofit
      • Web agency
      • Small business owner
      • Web developer
      • Educational institution
      • WordPress freelancer
      • Startup founder
      • One-person agency
      Get notified of updates.

      We’re constantly improving GravityKit. Fill out your email below and we’ll notify you anytime major updates drop.

      See past editions
      • Facebook
      • Twitter
      • Mastodon
      GravityKit is a Gravity Forms Certified Developer.

      Copyright © 2026, Katz Web Services, Inc.

      GravityKit and GravityView are registered trademarks of Katz Web Services, Inc.

      Before you go

      Take 25% off

      Our Black Friday sale covers GravityView Pro, the All Access Pass and the Lifetime All Access Pass, and ends December 1.

      See the Deals