Skip to content
Learnomy
Get Learnomy Pro

WP-CLI Commands

Free & Pro

Learnomy adds a wp learnomy command group. It is useful for the jobs that are painful in the browser: enrolling a list of people, checking why one student's progress looks wrong, repairing data after an import, and migrating from another LMS.

Everything here runs on your own server over SSH or a local shell. If you have never used WP-CLI, the only thing you need to know is that commands run from your WordPress directory.

Run commands as an administrator#

Several commands check that the person running them may do the thing being asked. WP-CLI has no logged-in user, so those checks fail with a permissions error unless you say who you are:

wp --user=1 learnomy enroll --user-id=42 --course=17

Use --user=1 (or any administrator's ID) on anything that writes. Read-only commands like stats and inspect do not need it.

Everyday commands#

Enrolling and unenrolling#

wp --user=1 learnomy enroll --user-id=42 --course=17
wp --user=1 learnomy enroll --user-id=42 --course=17 --source=manual
wp --user=1 learnomy unenroll --user-id=42 --course=17
wp --user=1 learnomy unenroll --user-id=42 --course=17 --source=manual

On enroll, --source records how the enrollment happened; leave it off unless you are reproducing a purchase. On unenroll, no --source removes every way the user has the course; --source removes only the access that source gave. A --user-id with no account is refused ("That user account does not exist, so nobody was enrolled.") and nothing is written; the same check applies to every way of enrolling, including the admin screens and the REST API.

Issuing and checking certificates#

wp learnomy certificate generate --user-id=7 --course=12
wp learnomy certificate verify a1b2c3d4-e5f6-7890-abcd-ef1234567890

generate issues the certificate for a student and a course and prints its UUID; it stops with an error if the certificate cannot be issued. verify looks a certificate up by that UUID, the same code printed on the certificate and used by the public verification page.

Checking one learner#

wp learnomy progress --user-id=42 --course=17
wp learnomy earnings --user-id=7

progress prints where a student has got to in a course, which is the fastest answer to "the site says I have not finished". earnings does the same for an instructor's revenue share.

Site overview#

wp learnomy stats

Counts across courses, students, enrollments and revenue. Useful as a before-and-after when you have run something that changes data in bulk.

Looking things up#

inspect prints one record in full, which is quicker than clicking through the admin when you are chasing a specific problem.

wp learnomy inspect course 17
wp learnomy inspect user 42
wp learnomy inspect enrollment 512
wp learnomy inspect quiz 8
wp learnomy inspect attempt 91
wp learnomy inspect cert 30
wp learnomy inspect subscription 14
wp learnomy inspect transaction 260
wp learnomy inspect db

Fixing data#

Repair#

wp learnomy repair data-integrity --dry-run
wp learnomy repair data-integrity
wp learnomy repair lesson-content
wp learnomy repair student-count

data-integrity is the one to reach for after an import or a bulk delete. It finds orphaned rows, drifted counters and progress that no longer matches the curriculum, and reports what it would change. Always run it with --dry-run first and read the report before letting it write.

student-count recomputes the enrolled figure shown on course cards when it has drifted. lesson-content repairs lesson bodies left malformed by an older import.

Cleanup#

wp learnomy cleanup orphan-enrollments --dry-run
wp learnomy cleanup orphan-certs
wp learnomy cleanup orphan-commissions
wp learnomy cleanup orphan-subscriptions --dry-run

Removes rows whose parent is gone. Same rule: dry-run first.

orphan-subscriptions ends (cancels, never deletes) memberships that are still open for a user who no longer exists, and stops their billing at Stripe or PayPal. The 2.3.0 update ends such rows on its own when nothing is being billed, and leaves the ones a gateway still charges for you, because cancelling at the gateway cannot be undone. A notice on the Learnomy dashboard says how many there are; end them with this command, or on LMS commerce > Subscriptions with the Deleted member, still billed filter and its End these subscriptions button (it asks you to confirm first).

Modules#

wp learnomy module list
wp learnomy module info membership
wp learnomy module enable membership
wp learnomy module disable pwa

Most Learnomy features are modules, and several ship switched off. This is the scriptable equivalent of the Modules screen, which is handy when you set up sites repeatedly. See Enabling Features and Modules.

Content#

wp learnomy course list
wp learnomy course create --title="Course title" --author_id=7
wp learnomy course delete 17 --yes

wp learnomy membership list
wp learnomy membership create --name="Pro" --price=19 --interval=monthly

Share a month's plan revenue#

wp learnomy membership split 2026-09 --dry-run
wp learnomy membership split 2026-09

Runs the same split as the monthly job, for any month. --dry-run lists what each instructor would receive and changes nothing. Every payment is marked once it has been shared, so running it again pays only payments that have not been shared yet: a renewal that completed after the monthly job ran, or a plan that had no published course until now. A month that was split before payments were tracked (versions before 2.1.5) is closed as it was: its payments are marked shared and nothing more is paid for it. The command refuses to run while the monthly job holds the same lock.

Snapshots before a risky change#

wp learnomy content snapshot
wp learnomy content restore
wp learnomy content migrate

snapshot saves lesson content before a migration so restore can put it back. Take one before any bulk content operation you have not run on this site before.

Migrating from another LMS#

wp learnomy migrate preview
wp learnomy migrate run
wp learnomy migrate status
wp learnomy migrate runs
wp learnomy migrate undo

preview reports what would be imported without writing anything. runs lists past imports and status reports on one; undo reverses an import that went wrong, which is the reason to prefer the CLI over the browser importer on a site with real data.

The browser importer covers the same ground with a UI. Use the CLI version for very large sites, where a browser import can time out. See Migrating from Another LMS.

Exports#

Three types are available: courses, students and earnings.

wp learnomy export students --file=/tmp/students.csv
wp learnomy export courses --file=/tmp/courses.csv
wp learnomy export earnings --file=/tmp/earnings.csv

Health checks#

wp learnomy selfcheck run
wp learnomy db migrate

selfcheck run verifies the install: tables present, routes registered, scheduled jobs in place. Run it after an update if something feels wrong. db migrate applies any pending schema change, which normally happens automatically on update.

Attachment protection#

wp learnomy protect-attachments --dry-run
wp learnomy protect-attachments

Moves lesson attachments, and with Learnomy Pro the files students submit to assignments, behind a permission check so a direct URL cannot be shared outside the course. With --dry-run it changes nothing: it lists each file it would move and each it would skip, and does not run the server check.

Learnomy Pro commands#

With Learnomy Pro active there is a second group, wp learnomy-pro.

wp learnomy-pro inspect cohort 141
wp learnomy-pro inspect assignment 342
wp learnomy-pro inspect learning-path 12
wp learnomy-pro inspect drip 17
wp learnomy-pro inspect db

inspect prints what Pro holds about one thing: a cohort's row, roster and related enrollments; an assignment and its submissions; a learning path's steps, students and completion rate; the drip rules active on a course. inspect db is a row count for every Pro table, useful as a before and after around a risky change.

wp learnomy-pro repair data-integrity
wp learnomy-pro selfcheck run

repair data-integrity fixes drift in Pro's own tables and is safe to run twice. selfcheck run is the Pro counterpart of wp learnomy selfcheck run.

Commands that are not on your install#

On the Pro side, seed-demo, wipe-demo, seed-model-site, test and the seed-demo / wipe-demo subcommands under spaces, cohorts, assignments, gifts and learning-paths are development and demo tools in the same way.

seed, seed-cleanup, seed-model-site, seed-quiz-attempts, seed-usecase and test are development and demo tools. They live in a directory that is stripped from the distributed plugin, so they will not appear on a normal install. If you see them, you are on a development checkout.