Search for keywords, like "PayPal", "Recurring Donations", and more.

Documentation / Developer Docs / GiveWP CLI

GiveWP CLI

GiveWP comes pre-packaged with support for the WordPress Command Line Interface (WP-CLI). This article demonstrates and walks you through how to access your GiveWP Data using only the command line.

For an introduction to WP-CLI, see the official handbook.

This article assumes a basic understanding of accessing the site via SSH via Terminal app (or similar).

screenshot of the Give Logo drawn in ASCII artwork style.
The “wp give ascii” command outputs an ASCII drawing of the GiveWP logo.

To use the GiveWP CLI, the commands use the format
wp give {subcommand}

Subcommands

ascii

You’ll just have to try the wp give ascii command. (Make sure to maximize your terminal window). It has no additional parameters.

cache

The wp give cache --action="delete" command is used to delete the GiveWP Cache. This forces the site to check the database again for things like the dashboard widget displaying today’s donations, and other GiveWP data that is cached.

details

The wp give details command has no options with it, and is used to display details of the GiveWP installation, such as the GiveWP version, the success/failure page URLs, and information related to currency and payment gateways enabled.

donations

The wp give donations command outputs recent donations to your GiveWP site. By default, it will output the most recent 10 donations regardless of status. The only optional parameter is --number which can be any positive number.

To list all donations on the site, use the command wp give donations --number=-1 but be aware that for sites with a large number of donations, this can be a rather larger and processor-intensive operation, so avoid running this command during high-traffic times.

donors

The wp give donors command outputs recent donors to your GiveWP site. By default, the command will output the most recent 10 unique donors to the site.

This command has several optional parameters.

  • --id accepts a donor ID to display only the donor data associated with a specific donor.
  • --email accepts a valid email address to display donor data associated with a specific email address
  • --number accepts any positive number, to display that number of donors, or “-1” to display all donors.
  • --create accepts a positive number. This parameter allows you to create up to 80 new donors in a single command. With no additional parameters, it will randomly generate a name and email for each donor it creates.
  • --form-id accepts a numerical form ID to display only donors associated with a specific form.
  • --name accepts a string. If the string has a space in it, place it in quotes.
  • --format accepts json , table, or csv. If you select csv it saves the resulting file in your uploads directory.

flush-logs

The wp flush-logs command deletes all logs (visible at at Donations > Tools > Logs) to save space in the database. It has no additional parameters.

forms

The wp give forms command allows you to see information regarding the forms on the site.

By default and with no additional parameters the forms command outputs a table of the 10 most recently created forms, in order of their created date.

This command has two optional parameters:

  • --id accepts a form ID. When this parameter is used, instead of returning a table, the command returns all data associated with the form in list form. This data includes form type, slug, created date, modified date, status, url, and donation stats.
  • --number accepts a number of forms to output in table format. Any positive number, or -1 to display all forms.

report

The wp give report command returns an income report of the total number of donations and total income amount.

This command accepts 4 optional parameters:

  • --id accepts a form ID. The default is blank, which returns data for all forms. If provided, the income report will be for one form only.
  • --date accepts this_month, last_month, today, yesterday, this_quarter, last_quarter, this_year, or last_year.
  • --start-date accepts a start date in the format MM/DD/YYYY. If you only use this parameter and not the end date, it will return donations for only this day.
  • --end-date accepts an end date in the format DD/MM/YYYY.

test-mode

The wp give test-mode --enable command puts GiveWP into Test Mode, activates the Test Donation payment gateway, and makes it the default gateway. The command requires either the parameter –enable or –disable to function.

Using GiveWP’s CLI to add test data

Developers and others testing new integrations with GiveWP or testing display of GiveWP data (forms, donations, donors, etc) can make use of built-in test data creation via the CLI.

It is critical that you ensure that forms and Donors already exist on the site before manually creating donations using this method. To that end, running the commands in the order they are listed here will result in correct data on the site.

The following commands are available for creating Test data:

test-donation-form

The wp give test-donation-form command creates donation forms on the site. By default, it will create 10 forms on the site with randomly assigned templates

This command has several optional parameters:

  • --count Number of donation forms to generate. Default: 10.
  • --template Which form template to use. Default: random
    Options: sequoia (for the multi-step template), legacy , or random .
  • --set-goal Set donation form goal. Default: false
  • --set-terms Set donation form terms and conditions. Default: false
  • --preview Preview generated data. Default: false
  • --consistent Make generated data consistent. Default: false

Example usage

wp give test-donation-form --count=10 --template=legacy --set-goal=true --set-terms=true --consistent=true

Need help and don’t want to leave the command line? Use this command:

wp help give test-donation-form

test-donors

The test-donors command creates fake donors on the site.

This command accepts the following optional parameters:

  • --count Accepts the number of donors to generate. Default: 10
  • --preview Preview generated data. Default: false
  • --consistent Make generated data consistent. Default: false

Example usage

wp give test-donors --count=10 --preview=true --consistent=true

test-donations

The test-donations command creates donations for existing forms and donors on the site. Make sure that forms and donors already esist before creating these fake donations.

This command accepts several optional parameters:

  • --count Number of donations to generate. Default: 10
  • --status Donation status. default: publish Options: publish,pending, refunded, cancelled, random (Get all available statuses with command: wp give test-donation-statuses
  • --total-revenue Total revenue amount to be generated. Default: 0 (generates unlimited revenue)
  • --preview Preview generated data. Default: false
  • --start-date Set donation start date. Date format is YYYY-MM-DD default: false
  • --params Used for passing additional parameters. Example usage: --params=donation_currency=EUR\&donation_cover_fees=true. Default: ”(empty string)
  • --consistent Make generated data consistent. Default: false

test-demonstration-page

The test-demonstration-page command generates a GiveWP demonstration page with all GiveWP shortcodes included

The only optional parameter is

  • --preview Preview generated data. Default: false

Example usage

wp give test-demonstration-page --preview=true

Last updated 11 months ago

Start Fundraising Better Today!

Get GiveWP Today
GiveWP Plans

Give Fundraising Newsletter

The Give Fundraising Newsletter will help you navigate the world of online fundraising like a pro. Each week we send out fundraising advice, Give LIVE announcements, and exclusive offers to our newsletter subscribers.