WP-CLI Commands
Learnomy overviewFree + ProGet Learnomy →
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
Section titled “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=17Use --user=1 (or any administrator’s ID) on anything that writes. Read-only commands like stats and inspect do not need it.
Everyday commands
Section titled “Everyday commands”Enrolling and unenrolling
Section titled “Enrolling and unenrolling”wp --user=1 learnomy enroll --user-id=42 --course=17wp --user=1 learnomy enroll --user-id=42 --course=17 --source=manualwp --user=1 learnomy unenroll --user-id=42 --course=17wp --user=1 learnomy unenroll --user-id=42 --course=17 --source=manualOn 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
Section titled “Issuing and checking certificates”wp learnomy certificate generate --user-id=7 --course=12wp learnomy certificate verify a1b2c3d4-e5f6-7890-abcd-ef1234567890generate 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
Section titled “Checking one learner”wp learnomy progress --user-id=42 --course=17wp learnomy earnings --user-id=7progress 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
Section titled “Site overview”wp learnomy statsCounts 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
Section titled “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 17wp learnomy inspect user 42wp learnomy inspect enrollment 512wp learnomy inspect quiz 8wp learnomy inspect attempt 91wp learnomy inspect cert 30wp learnomy inspect subscription 14wp learnomy inspect transaction 260wp learnomy inspect dbFixing data
Section titled “Fixing data”Repair
Section titled “Repair”wp learnomy repair data-integrity --dry-runwp learnomy repair data-integritywp learnomy repair lesson-contentwp learnomy repair student-countdata-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
Section titled “Cleanup”wp learnomy cleanup orphan-enrollments --dry-runwp learnomy cleanup orphan-certswp learnomy cleanup orphan-commissionswp learnomy cleanup orphan-subscriptions --dry-runRemoves 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
Section titled “Modules”wp learnomy module listwp learnomy module info membershipwp learnomy module enable membershipwp learnomy module disable pwawp learnomy module disable membership --yesMost 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. enable follows the same rules as the screen: a module that needs another one (Memberships Pro needs Membership, Certificates Pro needs Certificates) is refused until that one is on, and Commissions is refused while Solo academy mode is on. A refused command prints the reason, exits with a non-zero status and changes nothing.
disable prints the same lines as the screen when the site still owes people something through the module (live subscriptions, unpaid payouts, members waiting for a start date). At a terminal it then asks first; --yes skips the question. In a script it prints them and switches the module off, as it always has. A module nothing depends on is switched off with no question. See Enabling Features and Modules.
Content
Section titled “Content”wp learnomy course listwp learnomy course create --title="Course title" --author_id=7wp learnomy course delete 17 --yeswp learnomy course delete 17 --yes --force --confirm-title="Intro to Pottery"
wp learnomy membership listwp learnomy membership create --name="Pro" --price=19 --interval=monthlymembership create --interval takes daily, weekly, monthly, yearly or lifetime; synonyms such as annual, year or month are stored as the canonical word. It refuses a negative price and a name whose slug another plan already has, with a sentence and a non-zero exit. It also refuses while the Membership module is switched off, and names wp learnomy module enable membership. course delete refuses a course that still has students, the same as the Courses screen: deleting it removes their access, progress and quiz attempts. Archive the course instead, or add --force with the exact title in --confirm-title to delete it anyway.
Share a month’s plan revenue
Section titled “Share a month’s plan revenue”wp learnomy membership split 2026-09 --dry-runwp learnomy membership split 2026-09Runs 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.
Book the earlier sales
Section titled “Book the earlier sales”wp learnomy commission earlier-saleswp learnomy commission earlier-sales --bookShows the course sales made before Commissions was switched on that have no earning yet, with the total and the number of instructors. --book books them, exactly as Book the earlier sales on the Modules screen: once per sale, at today’s rates and net of partial refunds. Safe to repeat.
Snapshots before a risky change
Section titled “Snapshots before a risky change”wp learnomy content snapshotwp learnomy content restorewp learnomy content migratesnapshot 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
Section titled “Migrating from another LMS”wp learnomy migrate previewwp learnomy migrate runwp learnomy migrate statuswp learnomy migrate runswp learnomy migrate undopreview 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
Section titled “Exports”Three types are available: courses, students and earnings.
wp learnomy export students --file=/tmp/students.csvwp learnomy export courses --file=/tmp/courses.csvwp learnomy export earnings --file=/tmp/earnings.csvHealth checks
Section titled “Health checks”wp learnomy selfcheck runwp learnomy db migrateselfcheck 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
Section titled “Attachment protection”wp learnomy protect-attachments --dry-runwp learnomy protect-attachmentsMoves 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
Section titled “Learnomy Pro commands”With Learnomy Pro active there is a second group, wp learnomy-pro.
wp learnomy-pro inspect cohort 141wp learnomy-pro inspect assignment 342wp learnomy-pro inspect learning-path 12wp learnomy-pro inspect drip 17wp learnomy-pro inspect dbinspect 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-integritywp learnomy-pro selfcheck runrepair 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
Section titled “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.

