WP-CLI commands¶
Three command groups — wp cpm squad and wp cpm generate from Club Player Manager, and
wp ccp generate from Card Payment — all registered only
under WP-CLI, so they never run on a web request.
Shell access is the authorisation boundary
WP-CLI commands are not gated by the plugin's cpm_access / cpm_manage_all capabilities.
Anyone who can run wp on the server can run these. The capability checks still apply to
everything done through the browser.
wp cpm squad¶
Squad management from the command line — useful for setting a club up from a script, or fixing a secretary address without clicking through the admin.
wp cpm squad create¶
wp cpm squad create <name> [--type=<type>] [--dob-start=<date>] [--dob-end=<date>]
[--secretary-email=<email>] [--porcelain]
| Option | Default | What it does |
|---|---|---|
<name> |
required | The squad name |
--type=<type> |
Mixed |
Mixed or Girls |
--dob-start=<date> |
no lower bound | Earliest eligible date of birth, YYYY-MM-DD |
--dob-end=<date> |
no upper bound | Latest eligible date of birth, YYYY-MM-DD |
--secretary-email=<email> |
none | Squad secretary to assign |
--porcelain |
off | Print only the new squad ID, for scripting |
# A mixed squad.
$ wp cpm squad create "Under 9s"
Success: Created squad "Under 9s" (ID 12).
# A girls squad with a date-of-birth range and a squad secretary.
$ wp cpm squad create "U11 Girls" --type=Girls --dob-start=2015-09-01 \
--dob-end=2016-08-31 --secretary-email=jo@example.com
Success: Created squad "U11 Girls" (ID 13).
The date-of-birth range is what matches waiting-list sign-ups to a squad and decides which members are suggested for it, so it is worth setting even when the club thinks in year groups. (No import places a child by date of birth.) Both ends are optional here, unlike in the admin, so a squad created without them matches nobody.
wp cpm squad set-secretary¶
Sets or clears a squad's secretary. The address is stored lower-cased, matching how the access layer derives it from the signed-in user: the WordPress account whose email matches gains access to that squad and nothing else.
$ wp cpm squad set-secretary 12 jo@example.com
Success: Set the squad secretary for squad "Under 9s" (ID 12) to jo@example.com.
$ wp cpm squad set-secretary 12 --clear
Success: Cleared the squad secretary for squad "Under 9s" (ID 12).
Handing a squad over is this command, or the same field on the squad's detail page.
wp cpm squad list¶
Every squad and its squad secretary. --format takes table (default), csv, json, yaml,
ids or count.
Use it to find the ID set-secretary wants.
wp cpm generate¶
Realistic demo data for a development or staging install: seasons, squads, members and guardians, team and season registrations, payment products with GoCardless and offline payment state, and public waiting-list sign-ups.
Names are drawn from a broad range of world cultures, and every email address uses the reserved
@example.com domain, so nothing it creates can reach a real inbox.
wp cpm generate all¶
| Option | Default | What it does |
|---|---|---|
--players=<number> |
40 |
How many members to create |
--waiting-list=<number> |
12 |
How many public sign-ups to create |
--seed=<number> |
random | Fixed seed, for a reproducible dataset |
--yes |
off | Skip the confirmation prompt |
$ wp cpm generate all
Success: Created 40 players, 78 guardians and related data for season 2025/26.
$ wp cpm generate all --players=120 --waiting-list=30 --seed=42 --yes
A fixed --seed makes the same dataset every time, which is what you want for a screenshot, a demo
you will run twice, or a bug you need someone else to reproduce.
wp cpm generate players¶
For a site that already has its seasons and squads: adds players and their guardians to them, and creates nothing else — no season, squads, payment products, payments, team registrations or waiting-list entries.
wp cpm generate players [--players=<number>] [--season=<id>] [--squad=<id>[,<id>…]]
[--registration=<mixed|none>] [--seed=<number>] [--yes]
| Option | Default | What it does |
|---|---|---|
--players=<number> |
20 |
How many members to create |
--season=<id> |
active season | Season to register them against |
--squad=<id>[,<id>…] |
all squads | Squads to spread them over |
--registration=<mode> |
mixed |
mixed gives most players a season registration status (some joined part way through); none leaves them all unregistered, ready for a registration email test |
--seed=<number> |
random | Fixed seed, for a reproducible dataset |
--yes |
off | Skip the confirmation prompt |
Each player goes into one of the chosen squads and is born inside that squad's date-of-birth range; a Girls squad gets girls. A squad with only one end of its range set gets a one-year window from it, and one with no range gets a random youth age.
$ wp cpm generate players --players=15 --squad=7 --registration=none --yes
Success: Added 15 players and 26 guardians to season 2026/27; 0 have a season registration status (seed 812734). Run `wp cpm generate reset` to remove them.
wp cpm generate reset¶
Removes everything the generator created and nothing else, including players added with
generate players (your own season and squads stay). Generated records are tagged — members
carry a TESTDATA- FA Number prefix, and the IDs of the seasons, squads and products it made are
recorded in an option — so real records are left untouched even on a site carrying both.
$ wp cpm generate reset
Success: Removed 40 players, 12 waiting-list entries and 13 demo squads/seasons/products.
The environment gate¶
Both generator commands refuse to run in a production environment, so they cannot touch a live club's site.
The decision comes from WordPress's standard
WP_ENVIRONMENT_TYPE,
set as an environment variable or a wp-config.php constant. It defaults to production when
unset — so the generator is disabled by default until the environment is explicitly declared as
local, development or staging.
# In the shell…
export WP_ENVIRONMENT_TYPE=development
wp cpm generate all
# …or in wp-config.php:
# define( 'WP_ENVIRONMENT_TYPE', 'development' );
There is an escape hatch for a box whose environment type is mislabelled and cannot easily be changed:
It works as an environment variable or a PHP constant. Setting it on a production site defeats the
only guard between wp cpm generate reset and a real club's records — so don't.
wp ccp generate¶
Demo data for Card Payment on a development or staging
install: a small catalogue of products (one archived) and a spread of orders across every status,
from both the shop and emailed payment requests. Every guardian email address uses the reserved
@example.com domain. It does not need any real members: each order carries its own made-up member
details.
wp ccp generate all¶
| Option | Default | What it does |
|---|---|---|
--products=<number> |
6 |
How many products to create (at least 1) |
--orders=<number> |
20 |
How many orders to create |
--seed=<number> |
random | Fixed seed, for a reproducible dataset |
--yes |
off | Skip the confirmation prompt |
$ wp ccp generate all
Success: Created 6 products and 20 orders (seed 123456789). Run `wp ccp generate reset` to remove it.
$ wp ccp generate all --products=10 --orders=80 --seed=42 --yes
wp ccp generate reset¶
Removes exactly the products and orders wp ccp generate all created, tracked by ID in the
ccp_demo_data_ids option, and leaves real records alone.
Both commands have the same environment gate as wp cpm generate: they refuse to run unless
WP_ENVIRONMENT_TYPE is local, development or staging. Card Payment's own escape hatch is
CCP_ALLOW_TEST_DATA, as an environment variable or a PHP constant:
Related WP-CLI¶
Not the plugin's own, but the commands most often needed alongside it: