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

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end 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, or PDF and share them instantly with secure download links.

    • 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, including forms, entries, Views, feeds, uploads, and more.

    • 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

    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    View All Case Studies
  • Resources

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

    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
  • Plugins

    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end 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, or PDF and share them instantly with secure download links.

    • 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, including forms, entries, Views, feeds, uploads, and more.

    • 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.

    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

    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    View All Case Studies

    How to build...

    • Property Management
    • Product Catalog
    • Fundraising Dashboard
    • Real Estate Directory
    • Document Library
    • Academic Journal
    • Volunteer Management
    • Meal Tracker
    View All Guides
  • Resources

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

    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
    • GravityMigrate
    • GravityRevisions
    • GravitySearch
    • GF Widget for Elementor
    • GF Dynamic Lookup
    • GF Entry Tags
    • GF Event Field
    • GravityExport Lite
    • GF Zero Spam

    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
    • Contact
    • Docs Home
    • Gravity Forms Add-Ons

      • GravityView
      • GravityActions
      • GravityBoard
      • GravityCalendar
      • GravityCharts
      • GravityEdit
      • GravityExport
      • GravityImport
      • GravityMath
      • GravityMigrate
      • GravityRevisions
      • GravitySearch
      • GF Widget for Elementor
      • GF Dynamic Lookup
      • GF Entry Tags
      • GF Event Field
      • GravityExport Lite
      • GF Zero Spam
    • 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
    • Contact

    GravityMigrate

    • Migrating Gravity Forms from the command line with WP-CLI
    • Best practices to follow when moving data using GravityMigrate
    • Getting started with GravityMigrate
    • GravityMigrate hooks
    • How does GravityMigrate handle nested forms?
    • Migrating GravityKit demos to your own website
    • 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: 8 minutes

    Updated on August 10, 2026

    GravityMigrate includes WP-CLI commands for exporting and importing your Gravity Forms and GravityKit data from the command line. Every command uses the wp gk migrate prefix. This is useful for scripted migrations, moving data between servers over SSH, and migrating sites that are too large to export through the browser.

    Note: The command line is an alternative to the GravityMigrate screen in wp-admin, not a replacement. Both produce and read the same export bundle, so you can export in the browser and import on the command line, or the reverse.

    Before you begin #

    • WP-CLI installed on the server you run the commands on.
    • GravityMigrate active on both the source and destination sites. GravityKit Foundation, bundled with the plugin, registers the wp gk commands.
    • An administrator account. The export, import, and reset commands read and write your data, so they require one: pass --user=<administrator login>. Without it, the command stops and asks for an administrator.

    Quick start #

    The most common workflow is to export a bundle on one site and import it on another:

    # On the source site: export everything to a ZIP
    wp gk migrate export --user=admin --forms=all --data=all --output=/tmp/migration.zip
    
    # Copy the ZIP to the destination site (scp, rsync, etc.), then import it
    wp gk migrate import /tmp/migration.zip --user=admin --yes

    Exporting a bundle #

    wp gk migrate export writes the forms and data you choose to a portable ZIP bundle.

    # Export specific forms with their entries, Views, and pages
    wp gk migrate export --user=admin --forms=3,5 --data=entries,views,posts --output=/srv/backups/forms.zip
    
    # Export every form and every data type
    wp gk migrate export --user=admin --forms=all --data=all --output=/srv/backups/all.zip
    
    # Only entries created within a date range
    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 ZIP with a password
    wp gk migrate export --user=admin --forms=all --data=all --password="a-strong-password" --output=/tmp/secure.zip

    Flag

    What it does

    --forms=<ids>

    Comma-separated form IDs, or all.

    --data=<types>

    Comma-separated data types, or all. Defaults to entries,views,posts. See Data types below.

    --date-start=<Y-m-d>, --date-end=<Y-m-d>

    Limit exported entries to a date range.

    --password=<password>

    Encrypt the ZIP (AES-256).

    --public-url=<url>

    Rewrite this site’s address to <url> in exported file-upload links, so uploads download on import when the source’s own address is not reachable from the destination.

    --output=<path>

    Copy the finished ZIP to this path. Without it, the ZIP stays in the exports directory and is removed after three hours.

    --porcelain

    Output only the ZIP path.

    Tip: Use --public-url when the source site’s stored address is not reachable from the destination, for example a local or staging clone. Entry file uploads are downloaded from the addresses stored in the bundle, so they must resolve from the importing server.


    Importing a bundle #

    wp gk migrate import reads a bundle and writes its forms, entries, Views, and other data into the current site. Import into a clean destination when you can, so results do not stack.

    # Import everything in a bundle, skipping the confirmation prompt
    wp gk migrate import /tmp/migration.zip --user=admin --yes
    
    # Import only certain forms or data types from the bundle
    wp gk migrate import /tmp/migration.zip --user=admin --forms=3,5 --data=entries,views --yes
    
    # Import a password-protected bundle
    wp gk migrate import /tmp/secure.zip --user=admin --password="a-strong-password" --yes
    
    # Import without downloading entry file uploads
    wp gk migrate import /tmp/migration.zip --user=admin --skip-uploads --yes

    Flag

    What it does

    <zip>

    Path to the bundle. The first argument, required.

    --forms=<ids>

    Form IDs to import, or all (default). Each must exist in the bundle.

    --data=<types>

    Data types to import, or all (default), intersected with what the bundle contains.

    --password=<password>

    Password, if the bundle is encrypted.

    --skip-uploads

    Do not download entry file uploads.

    --yes

    Skip the confirmation prompt.

    --porcelain

    Output only the newly created form IDs, one per line.

    --download-timeout=<secs>, --max-download-bytes=<n>, --max-dump-file-size=<n>

    Per-run overrides for the import safety limits.

    Note: Importing writes into your Gravity Forms tables. Back up the destination site first, and prefer a clean destination so imported entries and Views are not mixed with existing data.


    Inspecting a bundle before importing #

    wp gk migrate inspect shows what a bundle contains without importing it: its forms, data types, source address, and whether its uploads will download from this server.

    wp gk migrate inspect /tmp/migration.zip
    
    # As JSON
    wp gk migrate inspect /tmp/migration.zip --format=json

    Checking migration state #

    wp gk migrate status reports whether an import is in progress, whether a previous import stalled, and whether an export left state behind to clean up.

    wp gk migrate status
    wp gk migrate status --format=json

    Clearing stuck migration state #

    If an import was interrupted and a later one is refused, wp gk migrate reset clears the stuck state: the temporary tables, the extracted files, and the progress locks.

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

    Data types #

    The --data flag accepts a comma-separated list of these types, or all:

    Type

    What it includes

    entries

    Form entries with their metadata and notes.

    uploads

    Entry file uploads. Downloaded from the source during import, so it requires entries.

    views

    GravityView Views.

    posts

    The pages that embed your Views, and other connected posts.

    revisions

    Form revision history.

    addon_feeds

    Add-on feeds, for example GravityView and GravityCharts.

    gravityflow

    Gravity Flow workflow activity, where present.

    drafts

    Saved and continued draft submissions.

    gf_settings

    Gravity Forms settings.

    gk_settings

    GravityKit settings.

    rest_api_keys

    Gravity Forms REST API keys.


    Output formats #

    Commands that print data support --format=table (the default, human-readable) and --format=json (machine-readable). For scripting, wp gk migrate export --porcelain prints only the ZIP path, and wp gk migrate import --porcelain prints only the newly created form IDs.


    Scripting a migration between two servers #

    Because --porcelain prints only the essential value, you can chain export and import over SSH:

    #!/bin/bash
    set -e
    
    # Export on the source site and capture just the ZIP path
    ZIP=$(wp gk migrate export --user=admin --forms=all --data=all --porcelain)
    
    # Copy it to the destination 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”: Make sure GravityMigrate is active. The commands are registered through GravityKit Foundation, which is bundled with every GravityKit plugin.

    “Run with –user=<an administrator login>”: The export, import, and reset commands require an administrator. Add --user= with an administrator’s username or ID.

    “Import already in progress”: A previous import did not finish. Run wp gk migrate status to confirm, then wp gk migrate reset --user=admin --yes, and try the import again.

    Entry file uploads did not download: The source site’s address is not reachable from the destination. Re-export with --public-url= set to an address that resolves from the importing server.

    The bundle’s database dump is too large: Raise the limit for a single run with --max-dump-file-size=<bytes> on the import command.


    Related articles #

    • Getting started with GravityMigrate
    • Best practices for moving data using GravityMigrate
    • GravityMigrate hooks
    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.
      Stay informed?

      Was this page helpful?

      Table Of Contents
      • Before you begin
      • Quick start
      • Exporting a bundle
      • Importing a bundle
      • Inspecting a bundle before importing
      • Checking migration state
      • Clearing stuck migration state
      • Data types
      • Output formats
      • 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
      • Coupons
      Support
      • Support
      • Contact
      • Documentation
      • Scope of Support
      • Brand Guidelines
      • 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.

      • 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.

      Floaty, GravityKit's astronaut mascot, relaxing on a beach lounger

      Gravity Summer Sale ☀️

      50% off our entire toolkit • From 25% off for the rest of the community

      Shop the Sale