Back to help center

WP-CLI commands

Gratora includes WP-CLI commands for database management, data seeding, and aggregate maintenance. All commands use the wp gratora namespace.

Prerequisites

You need WP-CLI installed and accessible from your terminal. Run all commands from your WordPress root directory or use the --path flag to specify it.

Available commands

wp gratora migrate

wp gratora migrate

Runs all pending database migrations. Gratora runs them for you on activation and after a version bump, so you only need this command when that did not happen.

When to use it:

  • After a plugin update that includes database changes
  • During initial setup if automatic migration did not complete

wp gratora recompute-aggregates

wp gratora recompute-aggregates

Recalculates all aggregate columns for donors, funds, campaigns, and forms. This rebuilds cached totals like total raised, donation count, and donor counts from the raw donation data.

Options:

Option Default Description
--scope=<scope> all Limit the rebuild to donors, funds, campaigns, or forms.

When to use it:

  • After importing donations directly into the database
  • If dashboard totals appear incorrect
  • After restoring a database backup

wp gratora seed

wp gratora seed

Creates fake test donations, and the donor records behind them, on a campaign you already have. Paid dates are spread over the last 90 days or so, so the dashboard and its charts have something to show. It does not create campaigns or forms, so create a campaign first.

Options:

Option Default Description
--donations=<n> 20 How many paid donations to create.
--yes Skip the confirmation prompt.

When to use it:

  • On a fresh installation when you want to explore the interface
  • On a staging site for demonstration purposes

Important: This command requires org-wide test mode. If test mode is off in Fundraising > Settings > Payment gateways, it refuses to run. Everything it creates is flagged as test data and is excluded from your reporting.