learndash/delete-course permanently deletes or trashes a course.
What it leaves behind is the part worth understanding.
Before you run it
Deleting a course does not delete its lessons, topics or quizzes. They survive as orphans: still in the library, attached to nothing, unreachable by learners. Enrolment and progress records are left behind too, pointing at a course that no longer exists. A course with steps therefore requires confirm_orphan_steps=true as well as the title. Prefer force=false, which trashes the post and is reversible. Permanent deletion is the option that needs a reason.
At a glance
| Ability | learndash/delete-course |
| Toolset | LearnDash — toolset/learndash |
| Group | LearnDash › Courses |
| Requires | AcrossAI Pro, plus LearnDash LMS active on the site |
| Capability | manage_options |
| Safety | Destructive — requires confirm_title, and confirm_orphan_steps when the course still has steps. |
| Repeatable | Not idempotent — each call changes the row set, so re-running is not a no-op |
| Ships in | AcrossAI Pro 0.9.16 and later |
How it works
LearnDash does not cascade deletions down a course outline. Steps nested under what you delete survive as orphans — still in the library, attached to nothing, invisible to learners and easy to lose track of.
So a course with forty lessons deleted outright leaves forty lessons in the library with no course. They are not broken, exactly — they can be attached elsewhere — but nothing points at them and nobody will find them by accident.
That is why the extra confirmation exists: a course ID says nothing about how much content is about to become unreachable.
Enrolment and progress records also survive, pointing at a course that no longer exists. They do no harm and they inflate reporting, and there is no cleanup for them here.
Prefer force=false, which trashes the post and is reversible. Permanent deletion is the option that needs a reason.
A trashed course stops being reachable by learners while everything remains restorable, which covers almost every reason somebody wants a course gone.
Not idempotent.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
course_id | integer | Yes | The course. |
confirm_title | string | Yes | Must exactly match the current title on the live record. |
confirm_orphan_steps | boolean | When the course has steps | Acknowledges that lessons, topics and quizzes are left orphaned. |
force | boolean | No | True deletes permanently; false trashes and is reversible. |
confirm | boolean | Yes — must be true | The irreversibility gate. Without it the call is refused before anything is touched. |
What comes back
| Name | Type | What it is |
|---|---|---|
course_id | integer | The course. |
orphaned_steps | integer | How many steps were left unattached. |
success | boolean | Whether the call completed. |
message | string | A one-line summary of what happened, suitable for showing a human. |
error_code | string | Present only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation. |
Example
Ask your assistant:
Delete the retired onboarding course.
It resolves to one call:
{
"ability": "learndash/delete-course",
"parameters": {
"course_id": 412,
"confirm_title": "Onboarding Essentials",
"confirm_orphan_steps": true
}
}Worth knowing
- Lessons, topics and quizzes survive as orphans.
- Enrolment and progress records survive too, pointing at nothing.
- Trashing removes learner access and stays reversible.
- Not idempotent.
Related abilities
- LearnDash Get Course Structure — see what would be orphaned
- LearnDash Detach Step — remove content without deleting it
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category