The upcoming release of Give 1.7 is going to include support for WP-CLI. This tool is perfect for developers who prefer working from the command line. Now you can view donation data, donor data, and more without leaving your keyboard.

The WordPress Command Line Interface (WP-CLI) is a set of tools that allow you to manage your WordPress site from the command line. This means you can accomplish many admin-related tasks of your WordPress install without ever taking your fingers off the keyboard.

The base WP-CLI commands allow you to perform common tasks, such as installing and updating plugins, backing up your database, or regenerating your thumbnails. WP-CLI is also extensible and allows plugins to register their own commands, and this is what Give 1.7 is introducing to the free Give plugin.

What will you be able to do with Give CLI?

The addition of command line support for Give allows you to retrieve details about your installation, your forms, your donors, and their donations. Here are some of the most useful commands you’ll find in version 1.7.

Give Plugin Details

The wp give details command gives you a quick overview of your Give plugin settings.

The wp give details command gives you a quick overview of your Give plugin settings.
The wp give details command gives you a quick overview of your Give plugin settings.

Forms

The wp give forms command returns a list the donation forms that you have posted to your site.

The wp give forms command returns a list the donation forms that you have posted to your site.
The wp give forms command returns a list the donation forms that you have posted to your site.

Adding the --id parameter to the forms command will return additional details about the specified form.

The wp give forms command returns a list the donation forms.
The wp give forms command returns a list the donation forms.

Donors

The wp give donors command allows you to list your donors, or create a new donor record from the command line.

The wp give donors command allows you to list or create a new donor record.
The wp give donors command allows you to list or create a new donor record.

Adding a new donor is as simple as executing a command like:

wp give donors --create=1 --email=john@example.com

Donations

The wp give donations command will retrieve the details of the most recent donations made on your site. You can limit the number of donations returned by adding the --number parameter to the command.

The wp give donations command will retrieve the details of the most recent donations made on your site.
The wp give donations command will retrieve the details of the most recent donations made on your site.

Report

The wp give report command retrieves a quick summary of the total earnings and number of donations made. By default, it will show you these two numbers for all donations made on your site for all time. You can limit the results of this report by a specified date range, or by the ID of a specific donation form.

The wp give report command retrieves a quick summary of the total earnings and number of donations made.
The wp give report command retrieves a quick summary of the total earnings and number of donations made.

Clearing the Cache

You can delete all transients related to Give by typing:

wp give cache --action=delete

Getting Started with WP-CLI

Want to get ready to use the Give CLI features? First check out the official WP-CLI site for instructions for how to get the WP-CLI library installed on your server.

If you’re familiar with Github you can review all the Give CLI commands here. Once Give 1.7 is released (and you’ve upgraded your version), the “give” commands will be available to you.

Shawn Hooper

Shawn Hooper is Director of IT at Actionable, where he enjoys combining code and data to build intelligent tools for teams and leaders. Hailing from Ottawa, Canada, Shawn has been building web applications since the late 90s, with a focus on WordPress since 2011. As a freelance developer, he has built sites for clients in the public and private sectors in both Canada and United States. He loves making use of great 3rd party APIs, promoting web accessibility and secure coding practices.

There are no comments

Join the Discussion

Your email address will not be published. Required fields are marked *