Give comes pre-packaged with support for the WordPress Command Line Interface (WP-CLI). This article demonstrates and walks you through how to access your Give 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 logo” command outputs an ASCII drawing of the Give logo.

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

Subcommands

cache

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

details

The wp give details command has no options with it, and is used to display details of the Give installation, such as the Give 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 Give 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 Give 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.

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.

logo

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

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 (added in version 2.1 of Give) puts give 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.